A
Anand
problem.. the code creates a header row when i see the rendered hTML
but it is not creating the table cell inside the row. ie. it is
rendering as <tr></tr>
instead of <tr></td> mmmmm </td></tr>
the namevalues is an array which contains all the categories of my
products at respective index position with respect to the grid. The
array is filled while itemdatabound.
below is the code i wrote in pre render..
private void itemsDataGrid_PreRender(object sender, System.EventArgs
e)
{
//Just before the Datagrid renders its output, add the extra
separator rows
DataGrid dg = (DataGrid)sender;
Table tbl = (Table) dg.Controls[0];
DataGridItem dgi;
TableCell cell;
int i;
int iAdded = 0;
for (i=0; i < nameValues.GetUpperBound(0); i++)
{
if (nameValues != DataTypeHelper.NullString && nameValues
!= null)
{
//Just so it picks up the formatting class for my Header, could
have used ListItemType.Item
// dgi = new DataGridItem(0, 0, ListItemType.Header);
dgi = new DataGridItem(5, 5, ListItemType.Header);
cell = new TableCell();
cell.ColumnSpan =7;
cell.Text = nameValues;
dgi.Cells.Add(cell);
//Add one to skip past the Header item
// //tbl.Controls.AddAt(i + iAdded + 1, dgi);
itemsDataGrid.Controls[0].Controls.AddAt(i + iAdded + 2, dgi);
iAdded = iAdded + 1;
added = false;
}
}
}
}
any help is greatly appreciated
thanks
anand
but it is not creating the table cell inside the row. ie. it is
rendering as <tr></tr>
instead of <tr></td> mmmmm </td></tr>
the namevalues is an array which contains all the categories of my
products at respective index position with respect to the grid. The
array is filled while itemdatabound.
below is the code i wrote in pre render..
private void itemsDataGrid_PreRender(object sender, System.EventArgs
e)
{
//Just before the Datagrid renders its output, add the extra
separator rows
DataGrid dg = (DataGrid)sender;
Table tbl = (Table) dg.Controls[0];
DataGridItem dgi;
TableCell cell;
int i;
int iAdded = 0;
for (i=0; i < nameValues.GetUpperBound(0); i++)
{
if (nameValues != DataTypeHelper.NullString && nameValues
!= null)
{
//Just so it picks up the formatting class for my Header, could
have used ListItemType.Item
// dgi = new DataGridItem(0, 0, ListItemType.Header);
dgi = new DataGridItem(5, 5, ListItemType.Header);
cell = new TableCell();
cell.ColumnSpan =7;
cell.Text = nameValues;
dgi.Cells.Add(cell);
//Add one to skip past the Header item
// //tbl.Controls.AddAt(i + iAdded + 1, dgi);
itemsDataGrid.Controls[0].Controls.AddAt(i + iAdded + 2, dgi);
iAdded = iAdded + 1;
added = false;
}
}
}
}
any help is greatly appreciated
thanks
anand