I am trying to code a RadGrid control in a web part but find the control is not consistent when developing via the designer vs developing programatically. One issue is the grid control paging. Even though all settings are configured correctly, the only way to show the paging control at the bottom of the grid was to set it to always show. I then discovered, that although the SharePoint list data is bound correctly and the data is visible, the paging control shows only "0 items in 1 pages". This is of course wrong, since I can see as many entries as the page holds (10 in the default case). I can also filter the values and see additional items, however, the page control still indicates 0 items in 1 page.
Here are the grid settings being loaded.
rgdIncidentList =
new Telerik.Web.UI.RadGrid();
rgdIncidentList.Width =
Unit.Pixel(1070);
rgdIncidentList.GridLines =
GridLines.Vertical;
rgdIncidentList.ShowHeader =
true;
rgdIncidentList.HorizontalAlign =
HorizontalAlign.Center;
rgdIncidentList.SelectedIndexChanged +=
new System.EventHandler(rgdIncidentList_SelectedIndexChanged);
pnlIncidentList =
new Panel();
pnlIncidentList.ID =
"pnlIncidentList";
pnlIncidentList.Controls.Add(rgdIncidentList);
CreateColumn(
"LinkTitle", 75, "MLE #", true, true, true);
CreateColumn(
"Incident_x0020__x0023_", 70, "Incident #", true, true, true);
CreateColumn(
"Location", 90, "Location", true, true, true);
CreateColumn(
"Zone", 70, "Zone", true, true, true);
CreateColumn(
"On_x0020_Scene", 50, "On Scene", false, true, true);
CreateColumn(
"Contact", 70, "Contact", true, true, true);
CreateColumn(
"Action_x0020_Type", 70, "ActionType", true, true, true);
CreateColumn(
"Action_x0020_Taken", 70, "Action Taken", true, true, true);
CreateColumn(
"Additional_x0020_Action", 70, "Additional Action", true, true, true);
CreateColumn(
"Noise_x0020_Type", 10, "Noise Type", false, false, false);
CreateColumn(
"Tickets_x0020_Issued", 10, "Tickets", false, false, false);
CreateColumn(
"Action_x0020_By", 10, "Action By", false, false, false);
CreateColumn(
"Officer", 10, "Officer", false, false, false);
CreateColumn(
"Badge", 10, "Badge", false, false, false);
CreateColumn(
"Contact_x0020_DOB", 10, "Contact DOB", false, false, false);
CreateColumn(
"Owner", 10, "Owner", false, false, false);
CreateColumn(
"Owner_x0020_Contact", 10, "Owner Contact", false, false, false);
CreateColumn(
"Entered", 10, "Entered", false, false, false);
CreateColumn(
"Comment", 10, "Comment", false, false, false);
CreateColumn(
"Created_x0020_By", 10, "Created By", false, false, false);
CreateColumn(
"Modified_x0020_By", 10, "Modified By", false, false, false);
rgdIncidentList.AllowPaging =
true;
rgdIncidentList.AllowCustomPaging =
true;
rgdIncidentList.PagerStyle.Mode =
GridPagerMode.NextPrevAndNumeric;
rgdIncidentList.PagerStyle.PageButtonCount = 10;
rgdIncidentList.PagerStyle.ShowPagerText =
true;
rgdIncidentList.PagerStyle.Visible =
true;
rgdIncidentList.PageSize = 10;
rgdIncidentList.AllowFilteringByColumn =
true;
rgdIncidentList.AutoGenerateColumns =
false;
rgdIncidentList.AllowSorting =
true;
rgdIncidentList.ClientSettings.AllowColumnsReorder =
true;
rgdIncidentList.ClientSettings.Selecting.AllowRowSelect =
true;
rgdIncidentList.ClientSettings.Scrolling.SaveScrollPosition =
true;
rgdIncidentList.AutoGenerateColumns =
false;
rgdIncidentList.MasterTableView.AllowCustomPaging =
true;
rgdIncidentList.MasterTableView.AllowPaging =
true;
rgdIncidentList.MasterTableView.AllowSorting =
true;
rgdIncidentList.MasterTableView.AllowFilteringByColumn =
true;
rgdIncidentList.MasterTableView.AutoGenerateColumns =
false;
rgdIncidentList.PagerStyle.AlwaysVisible =
true;
I've attached two screenshots, one of the grid control created by the designer and displayed on an aspx page. The other is of the grid control created programatically and displayed as a web part in a SharePoint 2007 site. The data is ordered a bit differently in the two examples, but the information is queried from the same SharePoint list. The web page uses an SQL query and the data model is bound to the control. The web part performs dll calls from the SharePoint library to obtain the same list information, the data model of which is bound to the control.
What needs to be changed or added such that the paging works correctly for RadGrid within a web part?
Any help is greatly appreciated.
Michael