Hello,
I'm having a problem converting my standard ASP.NET GridView with it's settings to a RadGrid solution. I've been struggling with this trying different options, but with no solution.
I have a page with an ASP.NET GridView, a DropDownList for "ItemsPerPage" selector, and a custom pager that uses the querystring to pass the pageNumber to my ObjectDataSource for SEO friendliness, I have EnablePaging="false". Everything here works fine, both the customer pager and the DDL for selecting the pageSize.
I'm trying to convert all of this to use the RadGrid, RadComboBox, and was hoping to use the RadGrid's pager functionality using EnableSEOPaging, or even use my custom pager, but either instance is causing a problem. Here are the options I've tried with partial success, each causing a different and frustrating conundrum.
Option 1) Using the RadGrid with it's pager and EnableSEO="true" SEOPagingQueryStringKey="page". This works GREAT !!
But my RadComboBox for the "ItemsPerPage" only works on the current page, when selecting "next page" the pageSize of the RadComboBox does not persist to the next page, it sets itself back to the Default pageSize. (I'm thinking it has something to do with setting the PageSize of either the RadGrid, or the MasterTableView)
Option 2) Using the RadGrid and Pager Template like in the sample at: Page Template Demo. Once again, this works GREAT !!, the PagerTemplate with the paging and RadComboBox for "ItemsPerPage" set in the MasterTableView works !, but I can't seem to get EnableSEOPaging to work for template paging. I know that SEO is automatically enabled when it spots a spider, but it's really important that I have this available for users, they have the option to do a query with various filters and save it as a "Favorite" search page for later use.
So, my questions are, working backwords...
With option 2) Is there a way to EnableSEOPaging with template paging, either programmatically, javascript, or otherwise ?
OR
With option 1) Get the RadComboBox for "ItemsPerPage" (which is outside the RadGrid) to persist and not reset.
Here's the code that I used in my standard GridView and DropDownList that works:
And, here is the code (very similiar) after changing to a RadGrid and RadComboBox, but doesn't change the PageSize for every page, only the current page:
Sorry for the lengthy post, I just wanted to be as clear as possible, I hope I was.
Any assistance in getting either option to work would be greatly appreciated.
Thank you in advance,
Ronnie
I'm having a problem converting my standard ASP.NET GridView with it's settings to a RadGrid solution. I've been struggling with this trying different options, but with no solution.
I have a page with an ASP.NET GridView, a DropDownList for "ItemsPerPage" selector, and a custom pager that uses the querystring to pass the pageNumber to my ObjectDataSource for SEO friendliness, I have EnablePaging="false". Everything here works fine, both the customer pager and the DDL for selecting the pageSize.
I'm trying to convert all of this to use the RadGrid, RadComboBox, and was hoping to use the RadGrid's pager functionality using EnableSEOPaging, or even use my custom pager, but either instance is causing a problem. Here are the options I've tried with partial success, each causing a different and frustrating conundrum.
Option 1) Using the RadGrid with it's pager and EnableSEO="true" SEOPagingQueryStringKey="page". This works GREAT !!
But my RadComboBox for the "ItemsPerPage" only works on the current page, when selecting "next page" the pageSize of the RadComboBox does not persist to the next page, it sets itself back to the Default pageSize. (I'm thinking it has something to do with setting the PageSize of either the RadGrid, or the MasterTableView)
Option 2) Using the RadGrid and Pager Template like in the sample at: Page Template Demo. Once again, this works GREAT !!, the PagerTemplate with the paging and RadComboBox for "ItemsPerPage" set in the MasterTableView works !, but I can't seem to get EnableSEOPaging to work for template paging. I know that SEO is automatically enabled when it spots a spider, but it's really important that I have this available for users, they have the option to do a query with various filters and save it as a "Favorite" search page for later use.
So, my questions are, working backwords...
With option 2) Is there a way to EnableSEOPaging with template paging, either programmatically, javascript, or otherwise ?
OR
With option 1) Get the RadComboBox for "ItemsPerPage" (which is outside the RadGrid) to persist and not reset.
Here's the code that I used in my standard GridView and DropDownList that works:
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!this.IsPostBack) |
{ |
// Set the page size as indicated in the config file. If an option for that size |
// doesn't already exist, first create and then select it. |
int pageSize = Globals.Settings.Entities.PageSize; |
if (ddlItemsPerPage.Items.FindByValue(pageSize.ToString()) == null) |
ddlItemsPerPage.Items.Add(new ListItem(pageSize.ToString(), pageSize.ToString())); |
ddlItemsPerPage.SelectedValue = pageSize.ToString(); |
gvwEntities.PageSize = pageSize; |
gvwEntities.DataBind(); |
} |
} |
protected void ddlItemsPerPage_SelectedIndexChanged(object sender, EventArgs e) |
{ |
gvwEntities.PageSize = int.Parse(ddlItemsPerPage.SelectedValue); |
gvwEntities.PageIndex = 0; |
gvwEntities.DataBind(); |
} |
And, here is the code (very similiar) after changing to a RadGrid and RadComboBox, but doesn't change the PageSize for every page, only the current page:
protected void Page_Load(object sender, EventArgs e) |
{ |
if (!this.IsPostBack) |
{ |
// Set the page size as indicated in the config file. If an option for that size |
// doesn't already exist, first create and then select it. |
int pageSize = Globals.Settings.Entities.PageSize; |
if (rcbItemsPerPage.Items.FindItemByValue(pageSize.ToString()) == null) |
rcbItemsPerPage.Items.Add(new RadComboBoxItem(pageSize.ToString(), pageSize.ToString())); |
rcbItemsPerPage.SelectedValue = pageSize.ToString(); |
rgdEntities.PageSize = pageSize; |
rgdEntities.DataBind(); |
} |
} |
protected void rcbItemsPerPage_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) |
{ |
rgdEntities.PageSize = int.Parse(rcbItemsPerPage.SelectedValue); |
rgdEntities.CurrentPageIndex = 0; |
rgdEntities.DataBind(); |
} |
Sorry for the lengthy post, I just wanted to be as clear as possible, I hope I was.
Any assistance in getting either option to work would be greatly appreciated.
Thank you in advance,
Ronnie