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

How To get Column index from column Name at client-side

1 Answer 409 Views
Grid
This is a migrated thread and some comments may be shown as answers.
suraj
Top achievements
Rank 1
suraj asked on 24 Dec 2008, 02:52 PM
Hi,

I Am using radgrid in my project. i am implementing a functionality...

for that i need column index using column name. Can anybody please provide it.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Kevin Babcock
Top achievements
Rank 1
answered on 28 Dec 2008, 12:30 PM
Hello Suraj,

You can easily use the RadGrid's client-side API to achieve the functionality you desire. Here is an example of how you might create a JavaScript method that would take a column name and return that column's index:

function getColumnIndexByUniqueName(columnName) { 
    var masterTableView = $find('<%= RadGrid1.ClientID %>').get_masterTableView(); 
    var column = masterTableView.getColumnByUniqueName(columnName); 
    var element = column.get_element(); 
    return element.cellIndex; 

I hope that helps. Let me know if you have any further questions.

Regards,
Kevin Babcock
Tags
Grid
Asked by
suraj
Top achievements
Rank 1
Answers by
Kevin Babcock
Top achievements
Rank 1
Share this question
or