海豚宝宝的代码生活

专注于.Net系统开发

导航

GridView实用技巧

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

posted on 2006-08-18 18:10  Bruse  阅读(164)  评论(0)    收藏  举报