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 ...
Hello,
I'm just following up to see if you need any further assistance with this issue. If so please let me know.
Hi,
Thank you for your feedback.
Please refer to this resource which I believe you will find helpful regarding the use of EnableDataViewState, as well as EnableAjax and EnableViewState:
http://es.infragistics.com/community/forums/t/65461.aspx
Please try to provide a working sample reproducing the "server not responding" error, and I will be glad to investigate it and suggest a resolution for you.
Hi
When i implemented the same changes to my application its still giving me Server Not responding error when i enable Ajax but in your sample code its works.I am clueless here.
Thanks & Regards
Hi Hristo ,
Thanks.
Its working after binding again in each postback
.But the point i couldn't understand is whats the use of EnableDataViewState = true if we have to rebind the grid in every post back.
The sorting will work even if I set EnableDataViewState = False and binds it in every post back exactly the same as setting EnableDataViewState = true.So not getting what exactly i am benefiting from setting EnableDataViewState = true.
Sorry I missed to explain the following:
When EnableDataViewState = true the grid needs to be supplied with its original data, e.g to bind on every postback. Failing to do this (as in my sample) results that the data stays in the view state as it went in.
So I suggest that you simpy provide the data on each postback:
if (Session["data"] == null)
{
Session["data"] = GetDataSource();
}
WebDataGrid1.DataSource = (DataTable)Session["data"];
Please let me know if you have further questions on the matter.