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

Get reordered columns?

3 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Albert
Top achievements
Rank 1
Albert asked on 05 Jan 2009, 04:07 AM
How do I get the reordered columns? Like Address is at the first column. But I reordered and dragged Name to the first column, the RadGrid1.Columns[0] is still referred to Address. Help

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jan 2009, 06:38 AM
Hi Albert,

I would suggest you to access Grid column using the Column's UniqueName property instead of index as shown below.

CS:
 GridColumn col = (GridColumn)RadGrid1.MasterTableView.GetColumn("ProductName"); 


Shinu
0
Albert
Top achievements
Rank 1
answered on 06 Jan 2009, 01:21 AM
Thanks. But I dn't no what the columns name after being reordered. What I do know is the column index's I need and the current column on that specific index.
0
Shinu
Top achievements
Rank 2
answered on 06 Jan 2009, 06:26 AM
Hi Albert,

The Column's UniqueName will not change on reordering the columns. Since reordering is taking place on the client side I would suggest you to access the GridColumn at the desired position on the client side using the following Javascript code.

JS:
 var masterTableView =  $find("<%=RadGrid1.ClientID %>").get_masterTableView(); 
  var ColumnName = masterTableView.get_columns()[0].get_uniqueName();    
  alert(ColumnName) 


Regards
Shinu
Tags
Grid
Asked by
Albert
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Albert
Top achievements
Rank 1
Share this question
or