I am converting an existing datagrid to a radgrid. During PreRender, I dynamically add a new row and set the cell with some text with a colspan to match the visible columns. For some reason, this does not work with a radgrid. The new row is created (I can view source of the rendered html and see the <tr> tags), but the cell is not added to the row when rendered.
Here is my code snippet:
int cols = 11;
foreach (GridItem dItem in gridResults.Items)
{
if (dItem.ItemType == GridItemType.Item || dItem.ItemType == GridItemType.AlternatingItem)
{
GridDataItem item = new GridDataItem(gridResults.MasterTableView, 0, 0, dItem.ItemType);
TableCell cell = new TableCell();
cell.ColumnSpan = cols;
cell.HorizontalAlign = HorizontalAlign.Justify;
cell.Text = ((DataRowView)dItem.DataItem)["Description"].ToString();
item.Cells.Add(cell);
int iPos = 0;
foreach (GridItem dgitem in dItem.Parent.Controls)
{
if (dgitem == dItem)
{
dItem.Parent.Controls.AddAt(iPos + 1, item);
break;
}
iPos++;
}
}
}
Suggestions? I am looking at the nestedviewtemplate, but I don't want users to have access to expand/collapse the section. I don't see a way to hide the expansion control in the grid.
Here is my code snippet:
int cols = 11;
foreach (GridItem dItem in gridResults.Items)
{
if (dItem.ItemType == GridItemType.Item || dItem.ItemType == GridItemType.AlternatingItem)
{
GridDataItem item = new GridDataItem(gridResults.MasterTableView, 0, 0, dItem.ItemType);
TableCell cell = new TableCell();
cell.ColumnSpan = cols;
cell.HorizontalAlign = HorizontalAlign.Justify;
cell.Text = ((DataRowView)dItem.DataItem)["Description"].ToString();
item.Cells.Add(cell);
int iPos = 0;
foreach (GridItem dgitem in dItem.Parent.Controls)
{
if (dgitem == dItem)
{
dItem.Parent.Controls.AddAt(iPos + 1, item);
break;
}
iPos++;
}
}
}
Suggestions? I am looking at the nestedviewtemplate, but I don't want users to have access to expand/collapse the section. I don't see a way to hide the expansion control in the grid.