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

hide template column conditionally

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Savyo
Top achievements
Rank 1
Savyo asked on 29 Nov 2013, 08:56 AM
Hi,

I have to hide a template column on the databound event conditionally. How can I achieve this.

Thanks in Advance
Savyo

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Nov 2013, 09:40 AM
Hi,

Please try the following code snippet to hide the GridTemplateColumn.

C#:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        GridDataItem DataItem = (GridDataItem)e.Item;
        if(your condition)
        {
            RadGrid1.MasterTableView.GetColumnSafe("columnUniqueName").Display = false;
        }
    }
}

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