Ajax update panel + unipager doesn't work.

Targutai Yesugei asked on September 5, 2017 11:56

I have a web part which is searching some content and showing it with pagination. I have to use update panel, so i checked "Use update panel" field in web part settings.

Now my pagination isn't working. I found this, but it's pretty old article - we can't use <%%> block in ascx file, so we using custom unipager looking like this :

public class CustomUniPager : UniPager
{
    protected override void OnInit(EventArgs e)
    {
        PageNumbersTemplate  = TransformationHelper.LoadTransformation(this, "[<li><a class=\"pageClicks\" href=\"{%PageURL%}\">{%Page%}</a></li>]");
        CurrentPageTemplate  = TransformationHelper.LoadTransformation(this, "[<li class=\"active\"><a class=\"pageClicks\">{%Page%}</a></li>]");
        FirstPageTemplate    = TransformationHelper.LoadTransformation(this, "[<li><a class=\"pageClicks\" href=\"{%FirstURL%}\">&lt;&lt;</a></li>]");
        LastPageTemplate     = TransformationHelper.LoadTransformation(this, "[<li><a class=\"pageClicks\" href=\"{%LastURL%}\">&gt;&gt;</a></li>]");
        PreviousPageTemplate = TransformationHelper.LoadTransformation(this, "[<li><a class=\"pageClicks\" href=\"{%PreviousURL%}\">&lt;</a></li>]");
        NextPageTemplate     = TransformationHelper.LoadTransformation(this, "[<li><a class=\"pageClicks\" href=\"{%NextURL%}\">&gt;</a></li>]");
        base.OnInit(e);
    }

My pagination code looks like this

<div class="pagination pull-right">
  <ul id="paging-container">
    <custom:CustomUniPager ID="UniPager1" PagerMode="PostBack" PageControl="ContentRepeater" PageSize="4" GroupSize="10" runat="server"/>
  </ul>
</div>

How can i fix my problem? Thanks in advance.

Recent Answers


Brenden Kehren answered on September 5, 2017 18:45

You may have to explain what you mean by "Now my pagination isn't working". Is it loading and not paging? Is it not loading at all? What is not working?

Something else to keep in mind is if you're settings on the pager are to use a URL parameter, then it is working as expected because the URL is simply creating a link with the URL parameters in it. Versus with the postback it stays on the same page and will cause a partial postback and not reload the page.

0 votesVote for this answer Mark as a Correct answer

Targutai Yesugei answered on September 5, 2017 20:17

Seems, like you catch my problem, it's just doesn't redirect me, and as i understood you, partial update doesn't cause redirect. Thank you.

Anyway, is there any solution to add pagination to webpart inside update panel?

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on September 6, 2017 00:50

So is your pager setup to use URL Parameters or Postback?

0 votesVote for this answer Mark as a Correct answer

Targutai Yesugei answered on September 6, 2017 05:57

Ehm, i don't know what are you mean, but let's say, that it's setup to use postback, because my pager is declared as following

    <custom:CustomUniPager ID="UniPager1" PagerMode="PostBack" PageControl="ContentRepeater" PageSize="4" GroupSize="10" runat="server"/>

If PagerMode="Postback" is what i need to answer your question.

0 votesVote for this answer Mark as a Correct answer

Targutai Yesugei answered on September 6, 2017 06:29 (last edited on September 6, 2017 15:28)

Hm, i just used <asp:UpdatePanel> (wrapped it around outer web part div) and turned off "Use update panel" in Kentico and it worked.

UPD, Actually, not. I'll try to describe problem

0 votesVote for this answer Mark as a Correct answer

bruce brennan answered on September 8, 2017 09:26 (last edited on September 8, 2017 09:34)

Another thing to remember is in case you're settings on the pager are to utilize a URL parameter, at that point it is filling in obviously in light of the fact that the URL is essentially making a connection with the URL parameters in it. UK Dissertation

0 votesVote for this answer Mark as a Correct answer

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