Paging in data list(show only 5 pages at time)

Posted by Sushant under ASP.NET on 7/5/2013 | Points: 10 | Views : 2892 | Status : [Member] | Replies : 4
Hi all

I want to add paging in datlist Like as followes
1. It should have previous and next button at start and end respectively
2. It should only display 5 (no of page) Pages between prev and next
3. After page no 5 it should display 6 to 10 similarly next

Sushat


Responses

Posted by: Jitendrasoft09 on: 7/5/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Sushant,

Datalist does not provide paging facilities as gridview, If you want to use datalist needs to do custom paging as below code-

<asp:DataList runat="server" id="dlGallery" 

RepeatColumns="4" RepeatDirection="Horizontal">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<img src="<%#DataBinder.Eval(Container.DataItem,"Image_URL")%>" width="90"
Height="90">
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
//Next/Prev Links.
<table border="0" width="410">
<tr>
<td align="left"><asp:LinkButton ID="lbtnPrev"
Runat="server">Prev</asp:LinkButton></td>
<td align="right"><asp:LinkButton ID="lbtnNext"
Runat="server">Next</asp:LinkButton></td>
</tr>
</table>


Refer below link-

http://www.codeproject.com/Articles/15567/Custom-Paging-for-DataList

Hope you are clear.

Jitendra Kumar
If my post helps you, plz mark as an answer.

Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 7/5/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Sushant,

There is not inbuilt paging available but we have to do custom paging

Use this article as resource for the same

Over here in this article i have created a Simple photo gallery using datalist in paging

http://www.dotnetfunda.com/articles/article2280-simple-photo-gallery-in-aspnet.aspx



Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sushant on: 7/6/2013 [Member] Starter | Points: 25

Up
0
Down
@Raj.Trivedi and @Jitendrasoft09
In my site paging capability is there but i
want paging capability according to my requirment
thanks


Sushat

Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Raj.Trivedi on: 7/6/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hello Sushant

Use this link as resource, modify the code as your requirement

http://www.dotnetspider.com/resources/43057-How-create-custom-paging-Data-List-control.aspx

Regard's
Raj.Trivedi
"Sharing is Caring"
Please mark as answer if your Query is resolved

Sushant, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response