| | |
Need help on Nested Repeater. Need to limit queries.
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
Hey, I created a datalist with a nested repeater. In the nested repeater, I need to limit the amount of records shown (only 10 allowed). However, just limiting the second query into the dataset doesn't work, only grabs 10 records. So I need to figure out a way of only showing 10 results for each. Basically, let's say this is my setup:
Now I need to limit each category to 10 rows only. There are about 22 categories and about 10,000 results. Obviously I need to do my best to just limit it to 220 results, not 10,000!! Any help will be grateful. Thank you.
ASP.NET Syntax (Toggle Plain Text)
category1 - 1 - 2 - 3 - 4 ... - 10 - 11 - 12 - 13 category2 - 1 - 2 - 3 - 4 ... - 20 - 21 - 22 - 23 category3 - 1 - 2 - 3 - 4 ... - 16 - 17 - 18 - 19
Now I need to limit each category to 10 rows only. There are about 22 categories and about 10,000 results. Obviously I need to do my best to just limit it to 220 results, not 10,000!! Any help will be grateful. Thank you.
I read through your question and could not quit understand the problem. How are you getting the data? from a database? why not restrict the number of records there? You could filter the dataset using the "DefaultView" row filter - http://msdn2.microsoft.com/en-us/lib...er(VS.71).aspx
. Send me your code and I will take a look.
. Send me your code and I will take a look.
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
It is dealt through a nested repeater. So the first repeater has no limits. It will show all 22-50 results needed. The second query (nested one), I would like to limit to 10 records per repeater. By limiting inside the query using LIMIT 10 or whatever, limits the results to all repeaters so that only 10 records are shown. So basically, this is what I want:
ASP.NET Syntax (Toggle Plain Text)
Category 1 Category 2 Category 3 1 result 1 result 1 result 2 result 2 result 2 result 3 result 3 result 3 result 4 result 4 result 4 result ......... 9 result 9 result 9 result 10 result 10 result 10 result '' However, with retrieving the results it will display all. So with 10,000 results, you can imagine how big of a list it would be. By limiting the inner query to 10, it will bind 4 results to category 1, 3 to category 2, 3 to category 3. I have put a loop on currently that limits the amount of records to 10 per category, but the query will still return 10,000 results, and store all 10,000 in the dataset. If you still need my code, just ask for it once more and I will put it up!
Last edited by SheSaidImaPregy; Nov 29th, 2007 at 3:08 pm.
•
•
•
•
yes i am using the itemdayabound method. could you explin please, and does it help against quering 10,000 rows when only 220 are needed?
displaying any listed data in a web page is a three steps process (basically):
- Getting the data from a database\source
- processing the data
- displaying the data
To cut a long story short query the top level lets say school classes. Bind the DataTable to the list and in the Item Data Bound Query the database for each class students.
Another thing to consider is to show just the top level (classes in my example) and provide a link to the students what I call Card View. This way you do not need to bother with processing records the user might not be interested with (the down side is the need for the user to click twice to get the data).
if you still find it unclear send me your code and I will take a look...
Good Luck
Shaul
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
Nope, makes perfect sense. The server is in the same building as the mysql server, so that is fine. I would just hate to tap the database.. 25 times instead of once.. you know? But if tapping the database 25 times and only retreving a total of 275 records compared to 10,000 (at the moment, but later above 100,000), the difference might be huge. Thanks.
•
•
Join Date: Sep 2007
Posts: 86
Reputation:
Solved Threads: 1
Are you also getting the category information with your query result? If you are, you could select TOP 10 record of each category and use the foreach method to filter out the categories and populate your nested repeater.
In ASP.NET this seems a bit difficult, but in PHP this problem could be resolved without having to pre-filter your result.
In ASP.NET this seems a bit difficult, but in PHP this problem could be resolved without having to pre-filter your result.
![]() |
Similar Threads
- SEO and AdWords API (Pay-Per-Click Advertising)
- SQL Injection Attack (Database Design)
- Big Repeater Question for you all (ASP.NET)
- Nested insert queries in a single query (MySQL)
- Nested For Loops (C++)
- MySQL nested query / joined query conversion help (MySQL)
Other Threads in the ASP.NET Forum
- Previous Thread: help me(pop up window for private chat
- Next Thread: Using Enterprise Library in asp.net(C#) web application
Views: 4827 | Replies: 12
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax anathor application asp asp.net bc30451 bottomasp.net browser businesslogiclayer button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css database datagrid datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownmenu edit expose feedback flash flv form formatdecimal forms formview google grid gridview homeedition hosting identity iframe iis index javascript jquery list menu migration mono mssql multistepregistration nameisnotdeclared object objects order problem ratings refer rotatepage save search security serializesmo.table session silverlight smartcard software sql sqlserver2005 suse textbox tracking typeof unauthorized update validation vb vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt xml youareanotmemberofthedebuggerusers






