'Table' cannot have children of type 'ListViewDataItem'

Posted by kazim sardar mehdi on Geeks with Blogs See other posts from Geeks with Blogs or by kazim sardar mehdi
Published on Thu, 27 Jan 2011 16:34:22 GMT Indexed on 2011/01/28 23:27 UTC
Read the original article Hit count: 466

Filed under:
I was using
System.Web.UI.WebControls.Table 
System.Web.UI.WebControlsTableRow 
System.Web.UI.WebControls.TableCell 
objects inside LayoutTemplate’s InstantiateIn method that’s inherited from ITemplate
as stated below:
Table  = new Table();
 
when compile got the following error on the YPOD(Yellow page of Death)

'Table' cannot have children of type 'ListViewDataItem'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: 'Table' cannot have children of type 'ListViewDataItem'.

 

Solution:

 

I Replaced

System.Web.UI.WebControls.Table 
System.Web.UI.WebControls.TableRow 
System.Web.UI.WebControls.TableCell 
with
System.Web.UI.HtmlControls.HtmlTable 
System.Web.UI.HtmlControls.HtmlTableRow
System.Web.UI.HtmlControls.HtmlTableCell 
and problem solved.
 

© Geeks with Blogs or respective owner