Hi,
I've created a LINQ query that returns a list of a type of class that i've created from the output of the LINQ query. I used the CodeRush add-in to convert the projected anonymous type to the class in question.
The data binds to the grid nicely but the sorting doesn't work. Do I need to implement something in this custom class or change some properties of the grid.......or both?
Thanks in advance and let me know if you need more from me
Mark
Hi Sarita,
I still can't get this to work. What i've done is to try the data on the form 3 ways.
If I use traditional SQL approach and define a SqlConnection, SqlCommand etc to return the data and then use the following syntax:
this
.UltraWebGrid1.DataSource = myData.Tables[0];
this.UltraWebGrid1.DataBind();
Everything works fine and the data sorts as expected.
If however I use LINQ and use that to bind to exactly the same grid the sorting doesn't work:
var customerQuery = from cust in dataContext.Customers
where cust.FirstName.Length > 0 && cust.ID < 1073741960
select cust;
this.UltraWebGrid1.DataSource = customerQuery.ToList();
Any ideas?
Hello Mark,
If the data is populated correctly, then the sorting should work. I was wondering what the HeaderClickAction and the AllowSortingDefault properties are set to. To enable the sorting onClient, please make sure these properties are set as follows:
//enable sorting
UltraWebGrid1.DisplayLayout.Bands[0].HeaderClickAction = HeaderClickAction.SortMulti;
//or Single
UltraWebGrid1.DisplayLayout.AllowSortingDefault = AllowSorting .OnClient;
Hope this helps.
Thanks
Sarita