Hi,
I'm hoping to use the 8.1 release of the UltraWebGrid along with LINQ to SQL to access data but i'm finding the performance is really bad.
I have 11,900 records in a view which when querying normally via other tools (including VS 2008) works fine. I noticed when I switched on SQL Profiler that the UltraWebGrid made 5 identical queries back to the database. The way I managed to deduce it was the UltraWebGrid doing this was it was consistantly this number yet when I switched to simply iterating the results and dumping them out on the page, it only made one round trip.
Are there any kind of optimisations available with the UltraWebGrid that do something like:
- Work out the number of pages of data based on the total result set and generate the associated pager based on that.
- Retrieve only the data you need for the current page.
It seems really wasteful especially with large amounts of data that the grid behaves in the way it does. Hopefully I've not yet found the optimisation I need!
Thanks
John
Just to follow up from this. I decided to see how the same performed using SQLClient and the query was made only one time and was significantly faster so the issue appears to be LINQ related.
Here is the System.Data.SQLClient code I used:
SqlConnection conn = new SqlConnection(CONNECTIONSTRING);
SqlCommand comm = new SqlCommand("Select * from MYTABLE", conn);SqlDataAdapter da = new SqlDataAdapter(comm);DataSet ds = new DataSet(); da.Fill(ds); grid.DataSource = ds;
SqlCommand comm = new SqlCommand("Select * from MYTABLE", conn);
da.Fill(ds);
grid.DataSource = ds;
Here is the comparative LINQ command:
var query = from MYTABLE in dc.MYTABLE select MYTABLE; grid.DataSource = query;
select MYTABLE;
grid.DataSource = query;
John i found a way to turn around this "problem" .. just call query.ToList() method when associating to your DataSource
My Sample Code :
uiGrdHist.DataSource = MobjBLL.GetHistoricoFromOTList(ots).ToList uiGrdHist.DataBind()
This, it will only make one query against database instead the four
Paulo Pereira