PageButtonCount in a Radpager Placeholder field

4 posts, 0 answers
  1. shemein
    shemein avatar
    28 posts
    Member since:
    Mar 2014

    Posted 30 Dec 2014 Link to this post

     I have an independent Radpager in my page with no grid or listview. I have an asp placeholder inside the fields of this pager which all the linkbuttons (numbers) will be added to this placeholder dynamically. I want to add the PageButtonCount to this placeholder to prevent increasing the with of raddatapager. becaz now each linkbutton is being added to the placeHolder and causes that to show all numbers. Please help me asap. I need to hide some of those pages like the PageButtonCount in this placeholder.


    <telerik:RadDataPager ID="RadDataPager1" runat="server" >                            
         <Fields>                                           
     <asp:ImageButtonID="prev"ImageUrl="previous.jpg"/> 
    <asp:PlaceHolderID="Placeholder1" runat="server"/>  
    <asp:ImageButtonID="Next"ImageUrl="Next.jpg"/>                                             <                                    </Fields>                                    </telerik:RadDataPager>
  2. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 02 Jan 2015 Link to this post

    Hello Shemein,

    You can't just put any ASP.NET control within the Fields collection. Please examine the following document.
    RadDataPager Elements

    If you prefer not to use and customize the built-in fields, you can try the TemplateField.
    RadDataPager Template

    You could see the TemplateField in action on the RadDataPager integration demo.
    RadDataPager Integration

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. shemein
    shemein avatar
    28 posts
    Member since:
    Mar 2014

    Posted 02 Jan 2015 in reply to Daniel Link to this post

    Hi Daniel,

    Thanks for your reply. I think we can. I have added asp.net and everything is working charming. The only thing that I want is adding something like PageButtonCount property to be able to shrink the length of the numbers that I have in my pager. I have used this:

    <telerik:RadDataPager ID="TopNavPagerRadDataPager" runat="server" Height="17px" CssClass="pager" OnFieldCreated="TopNavPagerRadDataPager_FieldCreated" OnTotalRowCountRequest="TopNavPagerRadDataPager_TotalRowCountRequest" Width="1340px">

    <Fields>

    <telerik:RadDataPagerTemplatePageField HorizontalPosition="LeftFloat">
    <PagerTemplate>
    <table>
    <tr>
    <td style="margin: 0px; padding: 0px; text-align: right">
    <div style="margin-top: 2px;">
    <asp:LinkButton ID="LinkButtonPrev" runat="server" Text="" CommandName="Page" CommandArgument="Prev" OnClick="LinkButtonPrev_OnClick" Font-Underline="False" OnClientClick="javascript:checkDirtyStatus();"><img src="~/Images/QuestionHeader/Page-Back.jpg" runat="server" /></asp:LinkButton>
    </div>
    </td>
    <td>
    <div style="margin-top: 5px">
    <asp:PlaceHolder runat="server" ID="numericPlaceHolder">
    </asp:PlaceHolder>
    </div>
    </td>

    <td style="margin: 0px; padding: 0px; text-align: left; width: 100%">
    <div>
    <asp:LinkButton ID="LinkButtonNext" runat="server" CommandName="Page" CommandArgument="Next" Text="" OnClick="LinkButtonNext_OnClick" OnClientClick="javascript:checkDirtyStatus();" Font-Underline="False"><img src="~/Images/QuestionHeader/Page-Forward.jpg" style="border:none;text-decoration: none;margin-top:3px" runat="server" /></asp:LinkButton>
    </div>
    <div  id="wrapupbuttondiv" runat="server">
    <asp:LinkButton ID="LinkButtonWrapUp" runat="server" Font-Underline="False" OnClick="LinkButtonWrapUp_OnClick" OnClientClick="javascript:checkDirtyStatus();" Text="Wrap-Up" ForeColor="#666666">
    </asp:LinkButton>
    </div>
    <div id="wrappingdevider" runat="server" >|</div>
    <div id="allpagesbuttondiv" runat="server">
    <asp:LinkButton ID="LinkButtonAllPages" runat="server" Font-Underline="False" OnClick="LinkButtonAllPages_OnClick" OnClientClick="javascript:checkDirtyStatus();" Text="All Pages" ForeColor="#666666">
    </asp:LinkButton>
    </div>
    <div id="allpagesdevider" runat="server" >|</div>
    <div  runat="server" id="nextsectiondiv">
    <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
    <td>
    <img src="~/Images/QuestionHeader/Section-Forward.jpg" runat="server" /></td>
    <td>
    <asp:LinkButton ID="LinkButtonNextSection" runat="server" Font-Underline="False" OnClick="LinkButtonNextSection_OnClick" OnClientClick="javascript:checkDirtyStatus();" Text="NEXT SECTION" ForeColor="#999999"></asp:LinkButton></td>
    </tr>
    </table>
    </div>
    </td>
    </tr>
    </table>
    </PagerTemplate>

    </telerik:RadDataPagerTemplatePageField>
    </Fields>
    </telerik:RadDataPager>
  5. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 07 Jan 2015 Link to this post

    Hello Shemein,

    You can create an user control to hold the page number buttons. Dummy code shown below:

    ascx
    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>

    ascx.cs
    public int ButtonCount { get; set; }
    protected void Page_Init(object sender, EventArgs e)
    {
        for (int i = 0; i < ButtonCount; i++)
        {
            Button btn = new Button();
            btn.ID = "Button" + i;
            btn.CommandName = "Page";
            btn.CommandArgument = i.ToString();
            PlaceHolder1.Controls.Add(btn);
        }
    }

    pager template:
    <PagerTemplate>
        <uc1:NumericButtons ID="NumericButtons1" runat="server"  ButtonCount="5" />
     ....

    Regards,
    Daniel
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top