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

[Solved] Dynamic Column hiding in Radgrid

1 Answer 329 Views
Grid
This is a migrated thread and some comments may be shown as answers.
satya
Top achievements
Rank 1
satya asked on 24 Jul 2009, 06:40 AM
Hi,

    I have a problem with hiding of a column which is added at run time. Actually i will be using DataTable as the datasource to the RadGrid. So now I wan to make few columns in the datatable invisible. After when i have given the datatable as datasource to the grid  when i have seen the column count of radgrid it is showing nothing. So i am unable to make a column invisible.
I had use concept of Datatable because all my columns will be retrieved from Database based on user creation.So the column names or column count will be dynamic.

Could you please help me out on this.


Thanks & Regards,
Satya.

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 27 Jul 2009, 11:44 AM
Hi atya,

I guess you want to hide AutoGeneratedColumns from code behind. If so try the following code snippet.
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)  
{  
    if (RadGrid1.MasterTableView.RenderColumns.Length > 5)   
    {  
        RadGrid1.MasterTableView.RenderColumns(5).Display = false;  
        RadGrid1.MasterTableView.RenderColumns(6).Display = false;  
    }  
}  
 

Additionally you can review the following help article:
Using columns

Kind regards,
Pavlina
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
satya
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or