This is a migrated thread and some comments may be shown as answers.

PageButtonCount in a Radpager Placeholder field

3 Answers 71 Views
DataPager
This is a migrated thread and some comments may be shown as answers.
shemein
Top achievements
Rank 1
shemein asked on 30 Dec 2014, 07:43 AM
 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>

3 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Jan 2015, 01:14 PM
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.

 
0
shemein
Top achievements
Rank 1
answered on 02 Jan 2015, 02:30 PM
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>
0
Daniel
Telerik team
answered on 07 Jan 2015, 02:08 PM
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.

 
Tags
DataPager
Asked by
shemein
Top achievements
Rank 1
Answers by
Daniel
Telerik team
shemein
Top achievements
Rank 1
Share this question
or