Custom transformation in UniPager Control

gopi c asked on March 24, 2016 05:26

How to write custom transformation for unipager to get pagination. i wrote following transformation...

<li><a href="<%# Eval("FirstURL",true) %>" aria-label="First"><span aria-hidden="true"><i class="fa fa-angle-double-left"></i></span></a></li>`
<li><a href="<%# Eval("PreviousURL", true) %>" aria-label="Previous"><span aria-hidden="true"><i class="fa fa-angle-left"></i></span></a></li>`
<li class="active"><a href="<%# Eval("PageURL")%>"><%# Eval("Page") %><span class="sr-only">(current)</span></a></li>`
<li><a href="<%# Eval("PageURL", true) %>"><%# Eval("Page") %></a></li>`
<li><a href="<%# Eval("NextURL", true) %>" aria-label="Next"><span aria-hidden="true"><i class="fa fa-angle-right"></i></span></a></li>`
<li><a href="<%# Eval("LastURL", true) %>" aria-label="Last"><span aria-hidden="true"><i class="fa fa-angle-double-right"></i></span></a></li>`

but it showing the one page.I need remaining pages also how can i achieve that in ascx transformation

Correct Answer

Matt Nield answered on March 24, 2016 12:11

I originally questioned your datasource setup, but it is actually your template that is the issue. You need to do a few things to get this working:

  1. Add a placeholder for the pages in your transformation like this: <asp:PlaceHolder runat="server" ID="plcPageNumbers"></asp:PlaceHolder>

  2. Create a new transformation for your pages such as: <a href="<%# Eval("PageURL", true) %>"><%# Eval("Page") %> (woo devnet)</a>

  3. Finally, in your unipager configuration, set the Pages transformation to the newly created transformation in step 1.

This should do what you need, the code <a href="<%# Eval("PageURL", true) %>"><%# Eval("Page") %></a> will simply return the current page, where as the placeholder will loop through the current and remaining pages making use of the Pages transformation and Current page transformation.

2 votesVote for this answer Unmark Correct answer

Recent Answers


gopi c answered on May 2, 2016 11:13

I resolved it.Wrote the tranformations like default with my design then i changed the replaced the default tranformations with my custom tranformations

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.