rama lakshmi

rama lakshmi

  • NA
  • 4
  • 2.8k

Checkbox state maintains but fall when paging performed

May 5 2016 2:27 AM
code behind:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
if (chk.Checked)
{
Session[chk.UniqueID] = true;
}
else
{
Session.Remove(chk.UniqueID);
}
}
protected void CheckBox1_DataBinding(object sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
chk.Checked = Session[chk.UniqueID] != null;
}
aspx:file:
<asp:TemplateField HeaderText="Select" >
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged"
OnDataBinding="CheckBox1_DataBinding" ></asp:CheckBox>
</ItemTemplate>
</asp:TemplateField>
 Checkbox state maintains but fall when paging performed by means selects same rows in page it automatically select another page 1 row again how to slove this by coing
 

Answers (1)