2011-12-14 75 views

回答

0

从您的代码中取出onclick事件。

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
    { if (e.Row.RowType == DataControlRowType.DataRow) 
     { 
      e.Row.Attributes.Add("style", "font-weight:bold;color:blue"); 
      e.Row.Attributes.Add("style", "cursor:pointer;"); 

     }} 
+0

和去哪里onclick事件? – SYSMAN 2011-12-14 16:41:16

0

我相信,你需要修改的最后一行使用FindControl方法来寻找CheckBox控件,并通过在CheckBox控件的ID,这样的事情:

e.Row.FindControl("myCheckBoxName").Attributes.Add("onclick", "location='WebForm1.aspx?id=" + DataBinder.Eval(e.Row.DataItem, "CustomerID") + "'";); 
+0

你的代码不正确 – SYSMAN 2011-12-14 16:40:00