<asp:TemplateField  HeaderText="修改" HeaderStyle-Width="70px" Visible="true" runat="server">
                        <ItemTemplate>
                            <asp:CheckBox ID="CheckBox1" runat="server" onclick="onChecked(this)"/>
                            
                        </ItemTemplate>
                    </asp:TemplateField><asp:CheckBox ID="CheckBox1" runat="server" onload="onChecked(this)"/>我用onload不行,用onclick可以触发,请问怎么办?

解决方案 »

  1.   

    在GridView1_RowDataBound事件中
    加上onblur属性protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onblur", "SetBGC(this)");
            }
        }
      

  2.   

    如果换成input控件,后台的CheckBox Id = row.FindControl("CheckBox1") as TextBox; 就获取不到了