Hi,
Our requirement is to maintain the status of the grid when user navigates from parent page to child page. So, when child page link in the grid is clicked, we are saving entire page state (dropdown list control selected values, grid sort, display of columns etc). Upon coming back from child page, we are assigning dropdown values back to controls from session and binding the grid to object that gets data from db based on dropdownlist control values. Then we are planning to set grid state (like sort order, display of columns etc)..
For this, when saving grid state, I need to loop thru columns and get col sort order. This code is out of radgrid events. I am doing this way:
foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
{
if (col is GridBoundColumn)
{
GridBoundColumn gbc = col as GridBoundColumn;
object sortOrder = gbc.SortExpression;
}
}
I know that I sorted column. But SortExpression (if I mouse over SortExpression, is always empty).
Please let me know how to get the sort expression or sort order programatically and also how to set grid sort order.
Thanks
Our requirement is to maintain the status of the grid when user navigates from parent page to child page. So, when child page link in the grid is clicked, we are saving entire page state (dropdown list control selected values, grid sort, display of columns etc). Upon coming back from child page, we are assigning dropdown values back to controls from session and binding the grid to object that gets data from db based on dropdownlist control values. Then we are planning to set grid state (like sort order, display of columns etc)..
For this, when saving grid state, I need to loop thru columns and get col sort order. This code is out of radgrid events. I am doing this way:
foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
{
if (col is GridBoundColumn)
{
GridBoundColumn gbc = col as GridBoundColumn;
object sortOrder = gbc.SortExpression;
}
}
I know that I sorted column. But SortExpression (if I mouse over SortExpression, is always empty).
Please let me know how to get the sort expression or sort order programatically and also how to set grid sort order.
Thanks