在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() + "')");
        }
    }
这样才能在这个事件中取到这一行的值

相关文章:

  • 2022-02-11
  • 2021-12-24
  • 2021-11-18
  • 2021-11-22
  • 2021-05-22
  • 2021-11-16
  • 2021-11-20
  • 2021-08-14
猜你喜欢
  • 2022-02-07
  • 2021-05-17
  • 2021-11-21
  • 2021-12-26
  • 2021-07-06
  • 2021-06-03
  • 2021-12-04
相关资源
相似解决方案