views:

501

answers:

2

I have 3 gridview control in my page. each grid itself i am using check box as a TemplateField.when i am selecting the first grid check box. it displays some records.In this time when i am press the F5(Referesh) button.All the events in the Page not fired.

check box 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>

Check box Event:

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

Please any one Help me.

A: 

Use this for the checkbox in the ItemTemplate to fire the event, dont press F5 to trigger

<asp:CheckBox ID="chkQuest" runat="server" OnCheckedChanged="CheckChanged" AutoPostBack="True" />
Jon
hi, i have done same code only.but OnCheckedChanged="CheckChanged" is not firing when the page is refreshed(F5).
The event should not be triggered when you press F5 but when you actually check/uncheck the checkbox
Jon
I am not get clearly. Please explain briefly.After press F5.check/uncheck in the check box is not firing.
Don't press F5, the event should fire after you check/uncheck the check box
Jon
A: 

I'm also getting similar kinda problem, the event is fired on check............ but not doing same on uncheck... plz help