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

Find Column Index.

1 Answer 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brijesh
Top achievements
Rank 1
Brijesh asked on 19 Oct 2010, 01:55 PM
Hi all,

I am using a Rad Grid in my Solution.
At such a stage i want to hide/show a column on the checked change of the Checkbox.

I can hide/show the column by its uniquename but when but onClick of checkbox i have written some javascript which accepts the column index.i have used following code 
RadGrid1.get_masterTableView().showColumn(index);  RadGrid1.get_masterTableView().hideColumn(index); 

Now the Problem is that how can i get the Index of the Column by its Column Name.

Thanks in Advance..

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 19 Oct 2010, 02:22 PM
Hello Brijesh,


You could also try the following approach to hide the column based on the column index.

Client Code:
function hideColumn() {
    var grid = $find('<%=RadGrid1.ClientID %>');
    var masterTableView = grid.get_masterTableView();
    var index;
    masterTableView.get_columns()[index].set_visible(false);
}


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