I have the following PagerTemplate. I need to hide the Previous link when user is viewing the first page and hide the Next link if user is viewing the Last page.
<PagerTemplate>
<table border="0" style="width: 100%;">
<tbody>
<tr>
<td style="float: right;">
<asp:LinkButton CommandName="Page" CommandArgument="Prev" ID="LinkButton2" runat="server"><< Previous</asp:LinkButton>
<asp:LinkButton CommandName="Page" CommandArgument="Next" ID="LinkButton3" runat="server" >Next >></asp:LinkButton>
</td>
<td style="clear: both"></td>
</tr>
</tbody>
</table>
</PagerTemplate>
Grid’s
PageIndexandPageCountproperties will help you here – Prev link should be shown/enabled only whenPageIndex > 0while Next link should be shown/enabled only whenPageIndex < PageCount - 1.Use row created event to find controls and alter the visibility. For example,
I am not sure of you need a custom template for current UI. You can use pager settings – for example,
And use PagerStyle for styling the UI.