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

Grid template Column Visibility control

2 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Anto (DLL Version : 2008.3.1314.35) asked on 04 Oct 2010, 03:46 PM
Hi EveryBody,

                  I have a Radgrid control on my .aspx page which has ten  telerik:GridTemplateColumn's.
                  I had set the visible property of all the ten columns to false.
                  Based on some conditions I want to make the columns visible and invisible.
                  I want to make some columns visible at a time and some columns at some other time in some case i'll show only one column.

                 How to do this visibility operation for telerik:GridTemplateColumn through c#.
                 Is it possible. If So, Anyone Please help me achieve this.

Thank you,
Anto.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 05 Oct 2010, 06:33 AM
Hello Anto,


One suggestion is accessing the column in PreRender event and setting the Visible property based on requirement. Sample code is shown below.

C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (i == 1) // Here check for condition
    {
        RadGrid1.MasterTableView.GetColumn("ColumnUniqueName").Visible = true;           
    }  
}



-Shinu.
0
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
answered on 05 Oct 2010, 07:31 AM
Hi Shinu,
Thank You for the Reply,
                         Its Working Fine. 
                         
Thank You.
 Anto-
Tags
Grid
Asked by
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 1
Anto (DLL Version : 2008.3.1314.35)
Top achievements
Rank 2
Share this question
or