Search code examples
asp.netgridviewupdatepanelautopostback

checkbox inside a gridview within updatepanel


I have a gridview with a checkbox in first column. I set checkbox property of autopostback="true". The gridview is inside the updatepanel. When checkbox is checked i want to make one panel as visible, which panel is outside the update panel. I check the code with check point, which is go through the code, but its not working. Can any one help me?..

Thanks in advance.

My code is here for your reference...

HTML Code:

<asp:Panel ID="ploperation" runat="server" CssClass="plop" Visible="False">
    <asp:LinkButton ID="lbtnasspam" runat="server" CssClass="panelbtn" Font-Names="Calibri"
                    Font-Size="14px" Font-Underline="False" OnClick="lbtnasspam_Click">Report As Spam</asp:LinkButton>
</asp:Panel>

 <asp:UpdatePanel ID="up" runat="server">
     <ContentTemplate>
         <asp:GridView ID="gvmail" runat="server" AllowPaging="True" AutoGenerateColumns="False">

              <Columns>
                  <asp:TemplateField>
                      <ItemTemplate>
                          <asp:CheckBox ID="chkchild" runat="server" AutoPostBack="true" OnCheckedChanged="chkchild_CheckedChanged"/>
                      </ItemTemplate>
                      <ItemStyle Width="15px" />
                  </asp:TemplateField>
              </Columns>         
         </asp:GridView>
     </ContentTemplate>                        
</asp:UpdatePanel>

C# Code:

protected void chkchild_CheckedChanged(object sender, EventArgs e)
{
    ploperation.Visible = true;
}

Solution

  • update panel does partial page loading.... check link

    so if you want to show your panel than include it also in your update panel.