I have very simple code in which I just want to check user have selected the record in grid or not for this what I have done is
public void chkSelect_CheckedChanged(object sender, EventArgs e)
{
CheckBox cbChkAllocate = (CheckBox)sender;
GridDataItem dataItem = (GridDataItem)cbChkAllocate.NamingContainer;
if (cbChkAllocate.Checked == true)
{
dtRoom = getDataTable();
dtRoom.Rows[dataItem.ItemIndex]["Transtatus"] = cbChkAllocate.Checked;
gwRoom.DataSource = dtRoom;
gwRoom.DataBind();
ViewState["dtRoom"] = dtRoom;
}
}
and In my aspx file I have placed this for check box
<telerik:GridTemplateColumn DataField="AllocationFlag" UniqueName="AllocationFlag" SortExpression="trans_status" >
<ItemTemplate>
<asp:CheckBox class="checkbox" ID="chkAllocate" runat="server" OnCheckedChanged="chkSelect_CheckedChanged" AutoPostBack="true" />
</ItemTemplate>
</telerik:GridTemplateColumn>
this event of checkbox selecteing gets fired every time which is ok and my datatable gets its value but after selecting more than many records and pressing submit button I am unable to get value from ViewState["dtRoom"] which gets null I have noting in my page load event