I used dataset as datasource to handle the hierarchical data in ultrawebgrid. When data is changed in the grid, I want to the grid show the sorted data. Right now it need two button clicks for the data to show in correct order. How to do it with only one button click? It looks like first button click save the data and second click updated the grid. I am still using 2009 vol 1. Thanks
Hello haijunw,
If I understand you correctly you need to sort columns in only one click that is made outside of the column header. In order to do that you must handle the event that fires when you change/update data in the grid – you can handle your own event (button click, dropdown change etc.) and put sorting logic there, or you may use grid events (if they fire) like “DataBound” or “Page_Load”.
To make one of the columns sorted when data grid is displayed again you can add following code to one of the above events:
MyGrid.Bands(0).SortedColumns.Clear;
MyGrid.Bands(0).SortedColumns.Add(MyGrid.Columns.FromKey("MyColumnName"), True);
This code will sort the column "MyColumnName” from “band 0” in the grid.
You can look at this example - http://help.infragistics.com/Help/NetAdvantage/ASPNET/2010.3/CLR4.0/html/WebGrid_Updating_Data_with_a_Data_Set.html to see how various grid events can be handled.
Thank you for using Infragistics components.
Please let me know if you need further assistance regarding your question.
Thank you.