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

radgrid in side tabs

1 Answer 44 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sudhakar
Top achievements
Rank 1
Sudhakar asked on 22 Sep 2014, 12:36 PM
Hi Team,

I have a radgrid with some rows in it .When i expand the each row there are three tabs inside it.
When i click on the first tab need to display the grid(grid name:compartmentgrid) under this tab.In this grid i have 8 coloumns and some columns have no data in it.
I need to find out the which column has no data and highlight that column with yellow color.
I am writing the code in the itemdatabound event for this grid.
How to find which column has null value because it is inside another grid and also this grid is displayed once you click on the tab.

Regards,
Sudhakar.


1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 25 Sep 2014, 08:58 AM
Hello Sudhakar,

In order to achieve the described behavior you could handle the ItemDataBound event of the nested RadGrid. In the handler you could iterate through the values for the cells every row. If there is no text in the cell you could set its background color. Check the following code snippet for illustration.

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridDataItem)
    {
        RadGrid grid = sender as RadGrid;
 
        GridDataItem dataItem = e.Item as GridDataItem;
 
        foreach (GridColumn column in grid.Columns)
        {
            if (column is GridEditableColumn && dataItem[column].Text == " ")
            {
                dataItem[column].BackColor = System.Drawing.Color.Yellow;   
            }
        }
    }
}



Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Sudhakar
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or