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

hide a column in my detail table

1 Answer 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erin
Top achievements
Rank 1
Erin asked on 26 Feb 2014, 12:32 PM
Hi.
I want to hide a column in my detail table based on a condition in master table view. How to achieve this?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Feb 2014, 12:46 PM
Hi Erin,

Please try the following code snippet to hide a column in detail table.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem && e.Item.OwnerTableView.Name == "ChildTable")
    {
        GridDataItem item=(GridDataItem)e.Item;
        GridDataItem parentItem = item.OwnerTableView.ParentItem as GridDataItem;
        if (parentItem["ColumnUniqueName"].Text == "Some Value")
        {
            GridTableView detailTable = (GridTableView)e.Item.OwnerTableView;
            detailTable.GetColumn("ColumnUniqueName").Display = false;
        }
    }
}

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