Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
300
Ajax Sorting
posted

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 ...

Parents
  • 16310
    Offline posted

    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.

    WebDataGrid_Sorting.zip
Reply Children