在GridView的RowDataBound事件中要取得某一列的数据,需要用下面的方法:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onMousedown", "javascript:onfocuscolor(this,'" + DataBinder.Eval(e.Row.DataItem, "ID").ToString() + "')");
}
}
这样才能在这个事件中取到这一行的值
转载于:https://www.cnblogs.com/brusehht/archive/2006/08/18/480738.html