I have a page designed with many HTML Tables which are hidden or displayed based on what needs to be shown at the time. There are various ASP.NET standard web controls within these tables, usually check boxes, radio button lists, text entry boxes, labels, etc. and all work just fine.
I am trying to put a DataGrid within one of the rows (under a tag) and get the error message:
Parser Error Message: System.Web.UI.HtmlControls.HtmlTableCellCollection must have items of type ‘System.Web.UI.HtmlControls.HtmlTableCell’. ‘MIIRS:DATAGRID’ is of type ‘MIIRS.WebControls.DataGrid’.
(MIIRS DataGrid inherits the DataGrid class and adds minor functionality to it, if you’re wondering)
I know I can redesign the page to put the DataGrid outside of a table, but if I can find a way to avoid this that’s what I want to do.
So my question is: is there any way to make the HtmlTable accept a DataGrid, GridView or similar object nested in it? And would changing to an asp table tag make it acceptable? Or any other creative solutions to minimize having to split up tables, or cannibalize my system the way I have it? 🙂
I have found one possible answer to the question. Using tags and CSS one can hide and display areas of HTML, so while I couldn’t get the Datagrid IN the table, I could put it outside of a table and simply display or hide it. When this is placed ‘in the middle’ of a table it requires splitting the table up into two parts (before and after).
This is the best way I’ve found so far to keep things looking the same on the page. I am still wondering why certain controls aren’t able to be put into an HtmlTable row though.