首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

-怎么取到GridView中Cell的值

2011-12-27 
-----------__如何取到GridView中Cell的值?1,abc.aspxprotectedvoidView_ItemDataBound(objectsender,Grid

-----------__如何取到GridView中Cell的值?
1,abc.aspx

protected   void   View_ItemDataBound(object   sender,   GridViewRowEventArgs   e)
{
    if(e.Row.Cells.Count   > 0)
    {
//lbDate.Text=e.Row.Cells[0].Text;
lbDate.Text=e.Row.RowIndex.ToString();
e.Row.Cells[1].Attributes.Add( "onclick ",   "PopupArea(event,   'divWrite ') ");
e.Row.Cells[1].Attributes[ "style "]= "CURSOR:   hand ";  
    }
}
......
<script   src= "js/jsPopup.js "   type= "text/javascript "> </script>

2,xyz.js

function   PopupArea(e,   areaId)
{    
if   (e.pageX   ||   e.pageY)
{
posx   =   e.pageX;
posy   =   e.pageY;
}
else  
if   (e.clientX   ||   e.clientY)
{
posx   =   e.clientX   +   document.body.scrollLeft;
posy   =   e.clientY   +   document.body.scrollTop;
//posy   =   e.clientY   +   document.body.scrollTop;
}

var   area   =   GetArea(areaId);
area.popuparea(posx,   posy);
}
這裡的PopupArea(e,   areaId)顯示abc.aspx頁裡的一個div,裡面有一個label,但是我不知道當點擊第i行時怎樣取得第這一行的Cells[0]的值?

謝謝!

[解决办法]
e.srcElement.parentElement.cells[0].innerText;

热点排行