Last post Oct 16, 2008 08:45 PM by kemaltolga
Oct 15, 2008 01:52 PM|kemaltolga|LINK
I have a details view which loads data froma linq datasource. The only crucial part is the <Where...> clause. It is set by a gridview's selectedvalue. It is very very very slow.
I noticed that if I remove the *DataSoureID* property from the DetailsView everything is very fast again. But setting the DataSOurceID properyt when I have selected a record from the grid, does not work. It fills the DetailsView not with the record selected
but the first record inthe database.
Oct 15, 2008 02:24 PM|marcind|LINK
Is this a Dynamic Data site? Is this using the default scaffold pages? Can you provide your code?
Oct 16, 2008 02:45 PM|kemaltolga|LINK
Marcin...thanks for you quick reply. Yes, it is a dynamic data web site, and yes scaffoldingalltables is set to true.
I was able to find and eliminate the issue. This is the old (slow) code...it is the where clause in the detailsview linqdatasource
here is the new (fast) code...
Now, what I do to populate the DetailsView is on the "Select" command of the grid I simply set the session variable *OffSiteItemSeq*.
Oct 16, 2008 03:59 PM|davidebb|LINK
You shouldn't have to use ViewState to get this working properly. Going back to the original issue, was an item selected on the GridView when you get the slow perf? Normally, the first item gets selected by default when you get to the page. But if for
some reason nothing is selected, then the DetailsView would bind to all the items, and that would indeed be super slow.
Oct 16, 2008 08:45 PM|kemaltolga|LINK
No, no item is selected by default. How can there? Both controls are loading and like you said, it seems like the details view is trying to bind to each record in the grid. Anyhow, I think the way it works now might be the best. I don't load data into the
detailsview unless I really need to, taht is when a record in the grid has been selected.