This is a migrated thread and some comments may be shown as answers.

Radgrid Sort problem

1 Answer 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Madhu
Top achievements
Rank 1
Madhu asked on 25 Nov 2008, 06:31 PM
Hi,
I have a RadGrid and a button on a page. I bind the grid to a datatable on the button click event.
The problem I face is once I sort certain column in certain order by clicking on the column header, It maintains this state even after I bind the grid to a new datasource. So how do i remove the old sort order on the grid and reset the grid to it's actual state while I rebind the grid to a new datasource.

thnx
madhu

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Nov 2008, 05:03 AM
Hi Madhu,

One suggestion will be to clear the SortExpression of the Grid in the ButtonClick event before setting the DataSource and then rebind the Grid.

CS:
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.SortExpressions.Clear(); 
        //set the Datasource here 
        //RadGrid1.DataSource="SqlDataSource1"
        RadGrid1.MasterTableView.Rebind(); 
    } 



Shinu.
Tags
Grid
Asked by
Madhu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or