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

Hide and unhide a column

1 Answer 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Janaki
Top achievements
Rank 1
Janaki asked on 30 May 2012, 10:43 AM
Hi all,

         My requirement is like, I have a bound column named age. I need that column to be made hide and unhide by my users. How to hide and unhide a column on an external button click?

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 30 May 2012, 10:47 AM
Hi,

Try the following code snippet to hide/show the Bound Column.

ASPX:
<asp:Button ID="button1" runat="server" onclick="button1_Click" Text="show/hide" />

C#:
protected void button1_Click(object sender, EventArgs e)
{
    GridBoundColumn column1 = (GridBoundColumn)RadGrid1.MasterTableView.GetColumn("UniqueName");
 
    if (column1 .Display == false)
    {
        column1 .Display = true;
    }
    else
        column1 .Display = false;
}

Thanks,
Shinu.
Tags
Grid
Asked by
Janaki
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or