 |
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

August 9th, 2007, 03:14 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Datalist Paging
I am working on a webapplication.Search results return thousands of records.I am using datalist(asp.net2.0) to display results.
But I amazed that datalist does not provide built in paging facility as other controls like gridview,detailsview and formview.
Please give me some solution to achieve this without using heavy code.Thanks
|

August 9th, 2007, 08:24 AM
|
Friend of Wrox
|
|
Join Date: Feb 2006
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You are refraining from using heavy code. But, not to disappoint you, achieving paging in datalist require hard work from you. You have to maintain few things in ViewState variable like the current page index, size of page(optional). You will have to check the number of rows returned by your query and accordingly, you will have to display that many links in footer. Also, You can add Four buttons in the footer i.e. First, Last, Next, Previous.
The other important thing is that you should always update the viewstate variable smartly. Use SqlDataAdapter1.Fill(DataSet1,startIndex,PageSize, "TableName"); to fill your dataset and bind that dataset to your datalist.
This is the logic you have to use. You can also search google, you will find source code there.
|

August 9th, 2007, 09:07 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks dear!
But I want some simpler solution,As I already searched a lot and that all provide same solution.
I am working on solution myself, and Inshallah I'll provide you people most simpler solution very soon.
Thank
|

August 9th, 2007, 09:18 AM
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
The only way i see for you to come up with a "simpler" solution is to create a control that inherits from the datalist control and then provide support for paging within the control itself. This would then give your control a behavior much like that of GridView where we just need to call NewPageIndex. Of course, this isn't necessary simpler, it is just a control that supports paging.
Good luck.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET
Professional IIS 7 and ASP.NET Integrated Programming
================================================== =========
|

August 9th, 2007, 02:36 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
nedo,
Are you not able to use the GridView control for some reason? That would give you built in paging without "heavy code".
-Peter
|

August 10th, 2007, 02:45 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I know that gridview offer strait way for paging,But that does not fullfill my formating requirements.Anyway thanks for contribution.
|

August 10th, 2007, 07:32 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
are you sure about that?? you can do almost anything with a gridview...
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
|

August 10th, 2007, 08:51 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Please provide an example of how you wish to format the data. It is very likely that you can do it with the GridView. I think about the ONLY restriction that you'll face is that the data will be presented in a top-down tabular style.
By turning off all the extra parts of the grid view (borders, headers, footers, etc.) and using a single column you can format it as you like and make it display just like a list format.
-Peter
|

August 11th, 2007, 05:09 AM
|
Registered User
|
|
Join Date: Mar 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks that solutions works for me
Really thankfull to you!
|

September 20th, 2007, 04:32 AM
|
Registered User
|
|
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hey guys, I want to share my problem.. My problem is that the columns displayed in gridview are top down.. I hav a single image column which I want in 4*4 matrix format..Plz help me out..
I tried with Datalist.. but as u said it requires a heavy code and I am nt able to achieve wid it..!!! Plz help me out soon..
|
|
 |