jssong2000
asked on
checkbox in gridview not fired
Hi Expert,
I am working on asp.net web form.
I designed a usercontrol. In the user control I added gridview.
I added checkbox in gridview. But the event chkOne_OnCheckedChanged is not fired after I clicked the checkbox.
Appreciated for your help!!
<asp:GridView ID="gvNewCust" runat="server" AutoGenerateColumns="false " DataKeyNames="HierarchyID" AllowPaging="true"
EnableViewState="false" HeaderStyle-CssClass="DQLa bel" Width="771px" OnRowDataBound="gvNewCust_ RowDataBou nd">
<AlternatingRowStyle BackColor="#CCCCCC" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkOne" Checked="false" runat="server" OnCheckedChanged="chkOne_O nCheckedCh anged" AutoPostBack="true"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="HierarchyID" HeaderText="HierarchyID" SortExpression="HierarchyI D" />
<asp:BoundField DataField="isDeleted" HeaderText="isDeleted" SortExpression="isDeleted" />
<asp:BoundField DataField="InsertTS" HeaderText="InsertTS" SortExpression="InsertTS" />
<asp:BoundField DataField="InsertUserID" HeaderText="InsertUserID" SortExpression="InsertUser ID" />
<asp:BoundField DataField="HierarchyNo" HeaderText="HierarchyNo" SortExpression="HierarchyN o" />
<asp:BoundField DataField="HierarchyName" HeaderText="HierarchyName" SortExpression="HierarchyN ame" />
<asp:BoundField DataField="RootNodeID" HeaderText="RootNodeID" SortExpression="RootNodeID " />
<asp:BoundField DataField="IsDefault" HeaderText="IsDefault" SortExpression="IsDefault" />
</Columns>
<HeaderStyle CssClass="DQLabel" Font-Bold="True" Font-Size="Small" />
</asp:GridView>
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -
//the following is not fired
protected void chkOne_OnCheckedChanged(ob ject sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
GridViewRow row = (GridViewRow)chk.Parent.Pa rent;
}
I am working on asp.net web form.
I designed a usercontrol. In the user control I added gridview.
I added checkbox in gridview. But the event chkOne_OnCheckedChanged is not fired after I clicked the checkbox.
Appreciated for your help!!
<asp:GridView ID="gvNewCust" runat="server" AutoGenerateColumns="false
EnableViewState="false" HeaderStyle-CssClass="DQLa
<AlternatingRowStyle BackColor="#CCCCCC" />
<Columns>
<asp:TemplateField HeaderText="Select">
<ItemTemplate>
<asp:CheckBox ID="chkOne" Checked="false" runat="server" OnCheckedChanged="chkOne_O
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="HierarchyID" HeaderText="HierarchyID" SortExpression="HierarchyI
<asp:BoundField DataField="isDeleted" HeaderText="isDeleted" SortExpression="isDeleted"
<asp:BoundField DataField="InsertTS" HeaderText="InsertTS" SortExpression="InsertTS" />
<asp:BoundField DataField="InsertUserID" HeaderText="InsertUserID" SortExpression="InsertUser
<asp:BoundField DataField="HierarchyNo" HeaderText="HierarchyNo" SortExpression="HierarchyN
<asp:BoundField DataField="HierarchyName" HeaderText="HierarchyName"
<asp:BoundField DataField="RootNodeID" HeaderText="RootNodeID" SortExpression="RootNodeID
<asp:BoundField DataField="IsDefault" HeaderText="IsDefault" SortExpression="IsDefault"
</Columns>
<HeaderStyle CssClass="DQLabel" Font-Bold="True" Font-Size="Small" />
</asp:GridView>
--------------------------
//the following is not fired
protected void chkOne_OnCheckedChanged(ob
{
CheckBox chk = (CheckBox)sender;
GridViewRow row = (GridViewRow)chk.Parent.Pa
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER