Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I speed up a dataview.rowfilter call?

Status
Not open for further replies.

lemkepf

Technical User
Oct 8, 2002
86
0
0
US
Hello .net gurus,

Some quick backgroud on my asp.net app: I have a datagrid and a nested datagrid within it. I've built in paging, sorting, etc. The problem is the users would like to be able to print out the whole list. So i created a page that doesn't use any paging. This works great for pages with < 600 rows. Anything greater than this and the processing time grows exponentionally.

Currently i have 2 datatables. The first binds to the first datagrid, then the second datatable get's created into a dataview, then filtered based on the key of the first table. Now... when this second table has > 2000 records in it and i'm filtering on every single "ItemDataBound" the app can take upwards of 200 seconds to complete.

I ran a profiler on my application and i saw that 185 of those 200 seconds is all on the dataview.rowfilter command on my second dataview. I know this .rowfilter get's called 1 time for each row in the main table. I've already done some research and put a sort on the view on
the key i'm filtering on. And tried some other things which don't seem to help any.

What are some things i can do to make the rowfilter go faster? Should i be using a datatable("table").select() instead? Should i take a completely different approach? How can i make this more efficient?
Thanks for all the help!

Paul
 
Why don't you let the dtabase do the filtering and only show they rows that are needed? If they want to view the whole list, export it out to a file for them and allow them to download that file (or write it directly to the content stream and stream it as excel for example).


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
That's the thing... i already do the database filtering stuff when they are paging through the result set. But... when they want to print it, i'm basically have 2 really big data tables. The second table get's filtered on every row that exists in the first one table.

I already provide a way to export it to excel... but basically i render this print pages datagrid and use that info to generate an excel spreadsheet... which takes the same time as printing it.
 
when they want to print it, i'm basically have 2 really big data tables. The second table get's filtered on every row that exists in the first one table.
But why can't you do that filtering on the database?


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
You have to remember how nested datagrids work.

i have 2 tables. The first table get's bound to the main datagrid. As each row executes it's "itemdatabound" method it takes that second table and says... ok, find me all the records in this table that corespond to the primary key of the first table. (So now i have a 1 to many relationship) then bind those records to the nested datagrid.

That's why i can't do it on the database level.
 
I know how nested datagrid's work, but you can do all of that in SQL. You just have to alter how it is actually output to the page...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
How would i alter how it's outputted?
 
You'll have to use the ItemDataBound method to intercept each row that is being bound and show or hide each column respectivley. Usind a repeater rather than a DataGrid will give you more flexibility as well.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
I guess i don't understand what your trying to get at... why would i care what columns to show? I looked at the repeater and it's basically a datagrid... just without the formatting built it. I still have to take my second dataset and filter on that to get my scaled down record set to bind to it. The grid isn't the problem... it's the filter on the second dataset.

Any other thoughts?
 
The reason that you would care about which columns to show, is that if you returned each row of the child record along with it's parent id (and/or the parent columns), you could alter the output to show the header row, along with each column of the child table. The repeater isn't just a DataGrid without formatting as it can be used to repeat anything and this is one of those situations.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Nevermind... i was just playing around with this and ended up using a hashtable instead of a datatable for my second table. Then instead of doing a filter i just looked up the key. It basically cut the rendering time down to about 65 seconds. Anyways, thanks for the help! I think the 15 users that have this kind of data can deal with 65 seconds. Thanks!
Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top