User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 425,796 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,148 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 541 | Replies: 6
Reply
Join Date: Oct 2004
Posts: 48
Reputation: SelArom is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
SelArom's Avatar
SelArom SelArom is offline Offline
Light Poster

limiting the number of rows in a repeater bound with xmldatasource

  #1  
May 12th, 2008
I have an xml documents that I need to bind using a repeater. This is to be a "preview" of a few rows of data with a "view more" link to see them all. Is it possible to do this using just one xml document? the xml file has about 15 items, but I only want to bind the first 4 or 5. Can this be done declaratively or do I have to make a new document that is a subset of the original and bind to that? seems pretty wasteful, but I cannot for the life of me find a way to stop databinding after X rows on any of the data controls!

any ideas? thanks!
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2004
Posts: 48
Reputation: SelArom is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
SelArom's Avatar
SelArom SelArom is offline Offline
Light Poster

Re: limiting the number of rows in a repeater bound with xmldatasource

  #2  
May 12th, 2008
well I ended up cheating and using a gridview control. I set the paging to true with a pagesize of 5 and then made the pager invisible.

I know it's not ideal because 1) gridview renders a table, and I wanted a list and of course 2) GridView is clientside paging, meaning it read all of the data instead of the first X rows and stopping...

BUT, it works, for now, until I find a more efficient solution. suggestions are still appreciated!

thanks
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,124
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is online now Online
Veteran Poster

Re: limiting the number of rows in a repeater bound with xmldatasource

  #3  
May 12th, 2008
I have found a link which may be of some use to you SelArom:

Some of the W3Schools tutorials are very good and this is an example of such!

Good luck and hope this helps!
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Oct 2004
Posts: 48
Reputation: SelArom is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
SelArom's Avatar
SelArom SelArom is offline Offline
Light Poster

Re: limiting the number of rows in a repeater bound with xmldatasource

  #4  
May 12th, 2008
thank you for the link. I am actually pretty familiar with the repeater controls and how to use them, but this is a special operation that I've not seen done before.

I do want to bind to a list but what I want to do is STOP binding after say 5 rows.

It seems like it would be more logical to just limit the data retrieved from the xml file. I know how to do this with a dataview if the data was coming from a dataset or database, but i'm using the xmldatasource which is a text file. I'm thinking I'd have to make my own class to bind to by reading the xml node by node until I hit the limit.

unless anyone else has any ideas! thanks
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,124
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is online now Online
Veteran Poster

Re: limiting the number of rows in a repeater bound with xmldatasource

  #5  
May 12th, 2008
Hmm I guess you could do what you originally intended and make a new file that is a subset of the original with the 5 or so items you wish to bind. although I understand your concern about this as it does seem somewhat un-elegant. Let me know your thoughts on this...
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Oct 2004
Posts: 48
Reputation: SelArom is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
SelArom's Avatar
SelArom SelArom is offline Offline
Light Poster

Re: limiting the number of rows in a repeater bound with xmldatasource

  #6  
May 13th, 2008
well I think loading the whole thing into memory and cheating with the paging is doing the trick for now. the list is thankfully not so long that loading the whole thing into memory for just a few rows will be overtaxing resources. if I ever find a better way I'll report back.

if anyone else ever has an idea, please do the same
You are somebody, just as I am somebody... but in the end, when you REALLY think about it, we are all nobody...
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,124
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is online now Online
Veteran Poster

Re: limiting the number of rows in a repeater bound with xmldatasource

  #7  
May 13th, 2008
OK sorry that i could not help more, not had much experience with using xml datasources. Maybe someone with more will reply.
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP.NET Forum
  • Previous Thread: Hi
  • Next Thread: HI

All times are GMT -4. The time now is 3:29 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC