After refresh (F5) Check CheckChanged page does not start, check is a child of Gridview

I have 3 gridview controls in my page. in each grid I use a checkbox as a TemplateField. When I select the first cell of the grid. it displays some records. At this time, when I press the F5 (Referesh) button. All events on the page are not fired.

in the grid:

<asp:GridView ID="gvSelectQuest"  runat="server" AutoGenerateColumns="False" 
    AllowSorting="True"  onrowdatabound="gvQuestion_RowDataBound">  
    <Columns>   
        <asp:TemplateField HeaderText="Select">
            <ItemTemplate >
                <asp:CheckBox ID="chkSelectGrp" AutoPostBack ="true" OnCheckedChanged ="CheckChanged" runat="server"/>
            </ItemTemplate>
        </asp:TemplateField>                
        <asp:BoundField DataField="_quest_AdminID" HeaderText="AdminID" />
    </Columns>
</asp:GridView>

      

Event checkbox:

public void CheckChanged(object sender, EventArgs e)
{
    CheckBox chk = (CheckBox)(sender);
    foreach (GridViewRow rowItem in gvQuesGroup.Rows)
    {
    }
}

      

Please help me.

0


source to share


1 answer


Use this for a checkbox in the ItemTemplate to fire the event, don't press F5 to fire



<asp:CheckBox ID="chkQuest" runat="server" OnCheckedChanged="CheckChanged" AutoPostBack="True" />

      

0


source







All Articles