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

RadGrid Expanded Item Style

3 Answers 160 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cole
Top achievements
Rank 1
Cole asked on 30 Jan 2011, 07:45 PM
I'm having trouble figuring out how to apply a left border to the first "cell" in an expanded item.  I have applied a bottom border to all cells in the parent row except for the expand/collapse row, and I wanted to apply a left border so that it makes a right angle with the bottom border of the parent row...what would be the best way to approach this?  Below is the code I am using for the bottom border of the parent row.

if (OrdersGrid.Items.Count > 1)
{
  for (int i = 0; i < OrdersGrid.Items.Count - 1; i++)
  {
    GridItem item = OrdersGrid.Items[i];
 
    for (int j = 1; j < item.Cells.Count; j++)
      item.Cells[j].Style["border-bottom"] = @"1px solid #828282;";
  }
}
else if (OrdersGrid.Items.Count == 1)
{
  GridItem item = OrdersGrid.Items[0];
  if (OrdersGrid.Items[0].Expanded)
    for (int j = 1; j < item.Cells.Count; j++)
      item.Cells[j].Style["border-bottom"] = @"1px solid #828282;";
  else
    for (int j = 1; j < item.Cells.Count; j++)
      item.Cells[j].Style["border-bottom"] = "none;";
}

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Jan 2011, 10:31 AM
Hello Cole,

Try the following code snippet to apply left border for first cell in expanded item.
C#:
GridItem item = RadGrid1.Items[0];
       if (RadGrid1.Items[0].Expanded)
           for (int j = 1; j < item.Cells.Count; j++)
           {
               item.Cells[j].Style["border-bottom"] = @"1px solid #828282;";
               item.Cells[2].Style["border-left"] = @"1px solid #828282;"; //apply left border for first cell
           }

-Shinu.
0
Cole
Top achievements
Rank 1
answered on 31 Jan 2011, 11:19 PM
Shinu,

Thanks for your timely response. Unfortunately, that applies the left border to the row, not the nested item.  I need it to apply the left border to the actual expanded item.  Does that make sense?

-Cole
0
Shinu
Top achievements
Rank 2
answered on 01 Feb 2011, 12:12 PM
Hello Cole,

I guess you want to set border for child item. If so the following code snippet shows how to set left border for child item and for child tableview.

C#:
GridItem item = RadGrid1.Items[0];
      if (RadGrid1.Items[0].Expanded)
      {
          GridTableView childtable = (GridTableView)RadGrid1.Items[0].ChildItem.NestedTableViews[0];
          //accessing NestedTableView of first grid item
          childtable.Style["border-left"] = "red";//applying left border to tableview
          GridItem childitem = childtable.Items[0]; //accessing first item in nested TableView
          childitem.Cells[2].Style["border-left"] = @"1px solid #828282;";//applying left border to child item
          
      }

-Shinu.
Tags
Grid
Asked by
Cole
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Cole
Top achievements
Rank 1
Share this question
or