Replacing Pager with RadDataPager on Image Gallery
Hey all,
I apologize ahead of time if this might be a nooby question. I have an override of the Simple List View of the image gallery that updates based on filtering criteria a user selects. I'm trying to replace the Pager control with the RadDataPager control because it's an easy implementation for getting the paging to work when the filtering is applied.
However, RadDataPager doesn't seem to initialize properly when the page is first loaded. It only loads one page. I do have the Pager control still in place since the default code requires it, and I don't know what the default code is doing, otherwise I would try to remove the Pager control.
Could the Pager control be interfering with the RadDataPager? Or does the RadDataPager control need to be set up in the code-behind in some special way? I tried looking for documentation on the control, but wasn't able to really find anything.
Or if someone could give me an idea on how to refresh the Pager control so that it updates the paging when the filtering is applied, that would be a great help, too.
Here is the template:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DealerNetImageTemplate.ascx.cs" Inherits="SitefinityWebApp.UserControls.Extranet.DealerNetImageTemplate" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.ContentUI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI.PublicControls.BrowseAndEdit"
Assembly="Telerik.Sitefinity" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Comments.Web.UI.Frontend" TagPrefix="comments" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Import Namespace="Telerik.Sitefinity.Web.UI" %>
<%@ Import Namespace="Telerik.Sitefinity.Modules.Comments" %>
<
sf:BrowseAndEditToolbar
ID
=
"browseAndEditToolbar"
runat
=
"server"
Mode
=
"Edit"
>
</
sf:BrowseAndEditToolbar
>
<
sf:SitefinityLabel
id
=
"title"
runat
=
"server"
WrapperTagName
=
"h2"
HideIfNoText
=
"true"
HideIfNoTextMode
=
"Server"
CssClass
=
"sfmediaFieldTitle"
/>
<
asp:DropDownList
runat
=
"server"
ID
=
"imageCategoryDDL"
AutoPostBack
=
"true"
></
asp:DropDownList
>
<
asp:DropDownList
runat
=
"server"
ID
=
"productColorDDL"
></
asp:DropDownList
>
<
telerik:RadListView
ID
=
"ItemsList"
ItemPlaceholderID
=
"ItemsContainer"
runat
=
"server"
EnableEmbeddedSkins
=
"false"
EnableEmbeddedBaseStylesheet
=
"false"
>
<
layouttemplate
>
<
ul
class
=
"sfimagesTmbList"
>
<
asp:PlaceHolder
ID
=
"ItemsContainer"
runat
=
"server"
/>
<
telerik:RadDataPager
runat
=
"server"
ID
=
"imgPager"
PagedControlID
=
"ItemsList"
>
<
Fields
>
<
telerik:RadDataPagerButtonField
FieldType
=
"Numeric"
/>
</
Fields
>
</
telerik:RadDataPager
>
</
ul
>
</
layouttemplate
>
<
itemtemplate
>
<
li
class
=
"sfimagesTmb"
>
<
div
style
=
"border: 1px solid black; padding:10px; text-align: center;"
>
<
sf:SitefinityHyperLink
runat
=
"server"
id
=
"singleItemLink"
/>
<
p
style
=
"text-align:center;"
><
asp:Label
runat
=
"server"
ID
=
"imgTitle"
CssClass
=
"center"
/></
p
>
<
p
style
=
"text-align:center;"
><
asp:Label
runat
=
"server"
ID
=
"imgSubtitle"
CssClass
=
"center"
/></
p
>
</
div
>
</
li
>
</
itemtemplate
>
</
telerik:RadListView
>
<
sf:Pager
id
=
"pager"
runat
=
"server"
Visible
=
"false"
>
</
sf:Pager
>
<
asp:PlaceHolder
ID
=
"socialContainer"
runat
=
"server"
></
asp:PlaceHolder
>
<
asp:Panel
runat
=
"server"
ID
=
"zeroImages"
Visible
=
"false"
>No images match filtering criteria.</
asp:Panel
>
Below is a snippet of the code-behind that deals with the paging. The rest of the code is just extending the base methods so that the filtering can be applied, but I can show all of that, too, if it would be of any help.
protected
override
void
OnLoad(EventArgs e)
ItemsList.AllowPaging =
false
;
ItemsList.Rebind();
ItemsList.AllowPaging =
true
;
ItemsList.PageSize = (
int
)MasterDefinition.ItemsPerPage;
ItemsList.Rebind();
Thanks in advance to those who are willing to help!
Hello Chris,
You can check and try the samples provided in the RadListView documentation and demo site for using RadDataPager for RadListView Paging.
More information is available here and here.
Regards,
Svetoslav Manchev
Telerik
Thanks, Svetoslav. Going off of that, it looks like the RadDataPager is set up correctly. But, actually, let me digress.
The issue I'm having is really with the sf:Pager control. Since I am building off of the default code for the image gallery, the sf:Pager control is required to be in the template. I tried working with the sf:Pager control. However, the sf:Pager control will not update the pagination when a user filters the images in the gallery. Instead, sf:Pager sticks with the paging that was created the very first time the control was loaded, and I can't figure out how to recreate the pages when filtering is applied.
So, is there a way I can make sf:Pager recreate the pages after the image filtering criteria is posted back to the server?
Hi Chris,
In case you are using the build-in pager control, you can check the solution proposed in that discussion by setting UrlEvaluationMode to QueryString in the advanced mode of the widget.
I hope the solution helps.
Regards,
Svetoslav Manchev
Telerik