读书人

-怎么取到GridView中Cell的值

发布时间: 2011-12-27 22:22:54 作者: rapoo

-----------__如何取到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;

读书人网 >asp.net

热点推荐