Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 9th, 2007, 03:14 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
  #2 (permalink)  
Old August 9th, 2007, 08:24 AM
Friend of Wrox
 
Join Date: Feb 2006
Location: noida, UP, India.
Posts: 133
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to gaurav_jain2403
Default

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.
  #3 (permalink)  
Old August 9th, 2007, 09:07 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #4 (permalink)  
Old August 9th, 2007, 09:18 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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

================================================== =========
  #5 (permalink)  
Old August 9th, 2007, 02:36 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

nedo,

Are you not able to use the GridView control for some reason? That would give you built in paging without "heavy code".

-Peter
  #6 (permalink)  
Old August 10th, 2007, 02:45 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know that gridview offer strait way for paging,But that does not fullfill my formating requirements.Anyway thanks for contribution.

  #7 (permalink)  
Old August 10th, 2007, 07:32 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

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
================================================== =========
  #8 (permalink)  
Old August 10th, 2007, 08:51 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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
  #9 (permalink)  
Old August 11th, 2007, 05:09 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks that solutions works for me
Really thankfull to you!

  #10 (permalink)  
Old September 20th, 2007, 04:32 AM
Registered User
 
Join Date: Sep 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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..
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datalist with paging venkatu2005 ASP.NET 1.0 and 1.1 Professional 1 July 17th, 2008 01:10 AM
paging datalist shanwaj ASP.NET 2.0 Basics 1 March 25th, 2008 12:03 AM
Datalist Paging webnathan ASP.NET 1.0 and 1.1 Basics 3 November 19th, 2007 11:11 AM
How to allow paging in datalist? okboy SQL Server 2005 1 January 21st, 2007 10:08 PM
Datalist Paging in C# caitydev ASP.NET 2.0 Basics 0 March 29th, 2006 06:53 AM



All times are GMT -4. The time now is 11:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.