How to dynamically change the number of results displayed by the UniPager

HelenaG Grulichova asked on January 24, 2012 07:41

How to dynamically change the number of results displayed by the UniPager

Correct Answer

HelenaG Grulichova answered on January 24, 2012 07:41

Please navigate to the file \CMSWebParts\Viewers\Basic\UniPager.ascx.cs. Please change the line:

pagerElem.PageSize = PageSize;

for the following code:

                if (CheckBox1.Checked)
                {
                    pagerElem.PageSize = 1000;
                    pagerElem.PagedControl.PagerForceNumberOfResults = 1000;
                    pagerElem.PagedControl.ReBind();                   
                    pagerElem.DataBind();
                }
                else {
                    pagerElem.PageSize = PageSize;
                }


Now add this method to the file:

    protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
    {
        SetupControl();
    }


The last thing to do is to alter the file CMSWebParts\Viewers\Basic\UniPager.ascx and add the code below:

<asp:CheckBox ID="CheckBox1" runat="server"
    oncheckedchanged="CheckBox1_CheckedChanged"  AutoPostBack="true" EnableViewState="true"/>


Now you’ve added a checkbox which, when checked, will display 1000 results instead of the number set in the properties of the UniPager web part.

-bp-
0 votesVote for this answer Unmark Correct answer

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