Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Anand #1
adding sub group headers dynamically for datagrid in prerender
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[i] 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[i] != DataTypeHelper.NullString && nameValues[i]
!= 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[i];
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
Anand Guest
-
Adding controls dynamically to a datagrid
Hi, We have a requirement, where based on the UI type selected in a dropdown, a control should get added to the column of a grid dynamically. For... -
Adding information dynamically to datagrid
Alright, so I can get columns to dynamically add. Now I'd like to add in some information that will be changing dynamically. Here's The code I've... -
Group Headers in Datagrid
Does the datagrid control provide a way to display records under group headers? In Microsoft Access, it's easy to create reports with detail... -
Filtering data and adding headers within same datagrid
Hello, Posted this over on the ADO.net group but it belongs here. I am working on a ASP page with a datagrid that has 5 columns that I bind to... -
Adding Columns to Datagrid Dynamically
Hello Everyone, I have a webpage with three link buttons and a datagrid. I would like to populate the same datagrid with different datasources by...



Reply With Quote

