I have searched and I cannot seem to find a solution to my issue, when creating a RadGrid programmatically (is that even a word?) everything seems to work fine except that something is wrong with the first page in the pager, I have a GridClientSelectColumn and when I try and use the select all box in the header I get this error:
Error: Unable to get value of the property '_selectAllRows': object is null or undefined
The strange thing is I can select things through the column itself and I can navigate the pager and select all from the other pages in the grid, when I do this something still messes up though. When I navigate away from the first page of the pager the grid is unable to load that first page again, nothing happens when you click on the first page.
If I build the grid on the front end everything seems to work fine.
The code is:
private RadGrid DefineGridStructure()
{
RadGrid grid = new RadGrid();
grid.ID = "OptOutGrid";
grid.Width = Unit.Percentage(100);
//grid.Height = Unit.Pixel(400);
grid.CssClass = "LeftFloat Top15Margin RadGridAutoSize";
grid.PageSize = 25;
grid.EnableAjaxSkinRendering = true;
grid.AllowPaging = true;
grid.AutoGenerateColumns = false;
grid.AllowMultiRowSelection = true;
grid.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric;
grid.ClientSettings.Selecting.AllowRowSelect = true;
grid.ClientSettings.Selecting.UseClientSelectColumnOnly = true;
grid.ClientSettings.Scrolling.AllowScroll = true;
grid.ClientSettings.Scrolling.UseStaticHeaders = true;
grid.ClientSettings.Scrolling.SaveScrollPosition = true;
//grid.MasterTableView.DataKeyNames = new string[] { "PanelistID" };
grid.MasterTableView.TableLayout = GridTableLayout.Fixed;
GridBoundColumn col;
col = new GridBoundColumn();
col.DataField = "PanelistID";
col.HeaderText = (string)GetLocalResourceObject("grid_PanelistID");
col.UniqueName = "PanelistID";
grid.MasterTableView.Columns.Add(col);
col = new GridBoundColumn();
col.DataField = "FirstName";
col.HeaderText = (string)GetLocalResourceObject("grid_PanelistFirstName");
col.UniqueName = "FirstName";
grid.MasterTableView.Columns.Add(col);
col = new GridBoundColumn();
col.DataField = "LastName";
col.HeaderText = (string)GetLocalResourceObject("grid_PanelistLastName");
col.UniqueName = "LastName";
grid.MasterTableView.Columns.Add(col);
col = new GridBoundColumn();
col.DataField = "Email";
col.HeaderText = (string)GetLocalResourceObject("grid_PanelistEmail");
col.UniqueName = "Email";
grid.MasterTableView.Columns.Add(col);
GridCheckBoxColumn chk;
chk = new GridCheckBoxColumn();
chk.DataField = "IsOptIn";
chk.HeaderText = (string)GetLocalResourceObject("grid_PanelistOptIn");
chk.ReadOnly = true;
grid.MasterTableView.Columns.Add(chk);
GridClientSelectColumn select = new GridClientSelectColumn();
grid.MasterTableView.Columns.Add(select);
return grid;
}
protected void PopulatePanelistGrid(List<int> ids)
{
RadGrid grid = DefineGridStructure();
grid.DataSource = GetPanelistData(ids);
grid.DataBind();
pnl_gridPanel.Controls.Add(grid);
}
Thank you,
James