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

hide column

4 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 05 May 2009, 09:06 AM
Hi,

I want to hide few columns when the button is clicked.

thanks.

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 05 May 2009, 09:51 AM
Hello Syed,

You can try out the following code to hide a column on a button click:
c#:
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadGrid1.MasterTableView.GetColumn("ColumnUniqueName").Display = false
                
    } 

Thanks
Princy.
0
Mark Galbreath
Top achievements
Rank 2
answered on 04 Feb 2010, 09:50 PM
How would that be done on the client, Princy?
0
Princy
Top achievements
Rank 1
answered on 05 Feb 2010, 05:14 AM
Hi Mark,

Here's the client side code to hide columns on a button's click event:
js:
function btnClick() 
     { 
        var colindex = $find("RadGrid1").get_masterTableView().getColumnByUniqueName("UniqueName").get_element().cellIndex; 
        $find("RadGrid1").get_masterTableView().hideColumn(colindex); 
           
    } 

Thanks
Princy.
0
Mark Galbreath
Top achievements
Rank 2
answered on 05 Feb 2010, 01:22 PM
Wierd.  I have
var tableView = $find('<%= radGrid1.ClientID %>').get_masterTableView();    
tableView.HideColumn( tableView.getColumnByUniqueName( uniqueColumnName ).get_element().cellIndex ); 
which is the equivalent of what you wrote, Princy, and it doesn't work.

Cheers!
Mark
Tags
Grid
Asked by
Syed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Mark Galbreath
Top achievements
Rank 2
Share this question
or