Search code examples
c#asp.netrepeater

How to avoid post-back of Check Box inside repeater


I am newbie for asp.net, I have a repeater which contains check box,whenever I check the check box I am firing an event on checkchanged,but the page postbacks. I have an update panel for the entire content in my page,but still postback occurs.Is there anyway to avoid postback. (Ps:To avoid Postback,I am meaning to avoid the flicker that occurs)

Thanks

   <asp:Repeater ID="rptrDepartment" runat="server" OnItemCommand="rptrDepartment_ItemCommand"
                            OnItemDataBound="rptrdepartment_databound">
                            <ItemTemplate>
                                <tr>
                                   <td>
                                      <asp:CheckBox ID ="chkRow" runat="server" OnCheckedChanged="ChkRow_ChkChanged" AutoPostback="true" />
                                  </td>
                                </tr>
                             </ItemTemplate>
                 </asp:Repeater>

And in my .cs page,

   protected void ChkRow_ChkChanged(object sender, EventArgs e)
{
   //some method
}

Solution

  • Just keep your repeater inside update panel rather than entire page, if you want some other controls also need partial postback then you can go for multiple update panels.