Hi There,
Whats the best approach to implement sorting in WebDatagrid ,The grid is bind through code behind and also its rebinds based on user selection.
And also want to have sorting default to a specific column on initial load.(Tried with adding the default column to ".Behaviors.Sorting.SortedColumns.Add" on initial load, not worked.)
Here is the Grid definition
Behaviour->Sorting->Enabled =True
EnableAjax=True,
EnableDataViewState=true,
ColumnSorted handled to rebind the data,but getting Server Not responding error.
If I set EnableAjax=False the ColumnSorted event works without error and sorts grid ,but the whole page refreshes and but default sorting fails.
I want to avoid the whole page refresh.
Thanks ...
Hi ,
I already have set up of AutoGenerateColumns=False as i defined all columns in markup itself.
I tried with your sample and that also not working attached the screen shots after sorting from your sample.
i am using Infragistics Version 14.1
<add assembly="Infragistics4.Web.v14.1, Version=14.1.20141.1015, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"/>
Thanks & Regards
Hello,
Thank you for posting in the Infragistics community ! Please find answers to your questions below:
1) Basically when you have EnableDataViewState = true you do not need to rebind the grid, as the grid loads its data from the DataViewState.
2) And also want to have sorting default to a specific column on initial load.(Tried with adding the default column to ".Behaviors.Sorting.SortedColumns.Add" on initial load, not worked.)
Do you have AutoGenerateColumns set to true ? IF this is the case then the grid columns collection is empty and you are actually adding null to the SortedColumns collections. Please see if this is the issue.
In every case I am attaching a small sample app that demonstrates how the grid is loaded with one of its columns sorted initially. Also, I have set EnableDataViewState = true, so I grid is bound at initial load only:
if (!IsPostBack) { WebDataGrid1.ClearDataSource(); WebDataGrid1.DataSource = GetDataSource(); }
Please review it and let me know if you have further questions on the matter, I will be glad to help.