Hi,
how to Maintain the state(userid) of checked records during paging in rad grid?
Below is my code for reference
and
Thanks.
how to Maintain the state(userid) of checked records during paging in rad grid?
Below is my code for reference
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="True" AllowPaging="True" PageSize="5" AllowSorting="True" OnNeedDataSource="RadGrid1_NeedDataSource" CellSpacing="0" GridLines="None" ShowGroupPanel="True"> <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true"></PagerStyle> <ClientSettings Selecting-AllowRowSelect="true" AllowDragToGroup="True"> <Selecting AllowRowSelect="True"></Selecting> </ClientSettings> <MasterTableView DataKeyNames="UserId"> <Columns> <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" /> </Columns> <PagerStyle AlwaysVisible="True"></PagerStyle> </MasterTableView> </telerik:RadGrid> <br /> <asp:Button ID="Button1" runat="server" Text="Save" OnClick="Button1_Click" Width="130px" Height="25px" ValidationGroup="val" /> <br />public partial class GroupUserCreation : System.Web.UI.Page{ Globas obj = new Globas(); CheckBox chkbox = new CheckBox(); string GroupId=""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable dt1 = obj.GroupDetails(); cmbgroupname.DataSource = dt1; cmbgroupname.DataTextField = "GroupName"; cmbgroupname.DataValueField = "GroupId"; cmbgroupname.DataBind(); } } protected void Button1_Click(object sender, EventArgs e) { try { GroupId = cmbgroupname.SelectedItem.Value.ToString(); foreach (GridItem item in RadGrid1.MasterTableView.Items) { GridDataItem dataitem = (GridDataItem)item; TableCell cell = dataitem["ClientSelectColumn"]; CheckBox checkBox = (CheckBox)cell.Controls[0]; if (checkBox.Checked) { int userid = Convert.ToInt32(dataitem.GetDataKeyValue("UserId").ToString()); if (GroupId != null) { obj.InsertGroupUserCreation(Convert.ToInt32(GroupId), userid); } } } } catch (Exception ex) { throw ex; } } protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e) { DataTable dt = obj.UserDetails(); RadGrid1.DataSource = dt; } }Thanks.