Link to home
Start Free TrialLog in
Avatar of jssong2000
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="DQLabel" Width="771px" OnRowDataBound="gvNewCust_RowDataBound">
                        <AlternatingRowStyle BackColor="#CCCCCC" />
                        <Columns>
                             <asp:TemplateField HeaderText="Select">
                                <ItemTemplate>
                                     <asp:CheckBox ID="chkOne" Checked="false" runat="server"  OnCheckedChanged="chkOne_OnCheckedChanged"  AutoPostBack="true"/>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="HierarchyID" HeaderText="HierarchyID" SortExpression="HierarchyID" />
                            <asp:BoundField DataField="isDeleted" HeaderText="isDeleted" SortExpression="isDeleted" />
                            <asp:BoundField DataField="InsertTS" HeaderText="InsertTS" SortExpression="InsertTS" />
                            <asp:BoundField DataField="InsertUserID" HeaderText="InsertUserID" SortExpression="InsertUserID" />
                            <asp:BoundField DataField="HierarchyNo" HeaderText="HierarchyNo" SortExpression="HierarchyNo" />
                            <asp:BoundField DataField="HierarchyName" HeaderText="HierarchyName" SortExpression="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(object sender, EventArgs e)
        {
            CheckBox chk = (CheckBox)sender;
            GridViewRow row = (GridViewRow)chk.Parent.Parent;
        }
ASKER CERTIFIED SOLUTION
Avatar of deepu chandran
deepu chandran
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jssong2000
jssong2000

ASKER

It works. Thank you!