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

[Solved] How to make sorting to work?

3 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ESM Dev
Top achievements
Rank 1
ESM Dev asked on 12 May 2009, 03:50 PM
Hi,

Had created columns dynamically in the button click event. The sorting functionality is not working. Came to know that sorting works when the columns are created in the Grid_Init Event but here that's not possible to create because columns will be changed based on the item selected from the dropdown list. Answers are appreciated if someone have fix to this problem.

Thanks
Venkat

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 May 2009, 05:15 AM
Hi Venkat,

I would suggest you to create the Grid columns in the Init event and change the Column's DataField and Rebind the Grid in the button Click event. Here is the code which I tried on my end.

CS:
 
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) 
        { 
            if (col.ColumnType == "GridBoundColumn"
            { 
                GridBoundColumn bnCol = (GridBoundColumn)col; 
                bnCol.DataField = "ProductID"
            } 
        } 
        RadGrid1.MasterTableView.Rebind(); 
    } 


Shinu
0
ESM Dev
Top achievements
Rank 1
answered on 13 May 2009, 05:01 PM
Hi Shinu,

Tried but its still not doing. Basically my requirement is to display the backend table data on to the grid. All the tables are added to the dropdown list, based on the item selected from dropdown list the respective table data needs to be displayed in the grid with all functioanlities like Sorting, Editing, Paging.

Venkat
0
Yavor
Telerik team
answered on 18 May 2009, 07:36 AM
Hi ESM,

How is the control populated with data? Keep in mind, that some of the functionalities of the grid control require that it is properly populated with data (using advanced databinding), and in the proper page event.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
ESM Dev
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
ESM Dev
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or