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

Hide Grid Rows/Cells using triggers

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 05 Sep 2012, 09:48 PM
Is there a way to hide cells or entire rows in a grid using a trigger such as specific text or a blank cell?  For example, in the case that a grid row is essentially one cell, can you code in a switch to hide the row and its label (header row) if the cell is blank or did not receive inputs or information from a corresponding web form?  Thanks in advance.  Your help and advice is much appreciated. 

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 06 Sep 2012, 06:40 AM
Hi Oliver,

I am not quite sure about your requirement. You can hide the column based on the cell as follows.

C#:
protected void Radgrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
   if (e.Item is GridDataItem)
   {
       GridDataItem ditem = (GridDataItem)e.Item;
       if (ditem["UniqueName"].Text == " ")
       {
          Radgrid1.MasterTableView.GetColumn("UniqueName").Display = false
       }
   }
}

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