Search code examples
asp.net-mvcasp.net-placeholderhtmltable-control

How view hmlTable in asp.net mvc?


Can I use HtmlTable class in asp.net MVC?

I created HtmlTable object in Controller class:

 var Table1 = new HtmlTable();

How to view it in the web page?

When I use:
PlaceHolder1.Controls.Add(Table1); in Controller class
and
<asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder> in index.cshtml
I have warning "Unrecognized namespace 'asp'"
How bind PlaceHolder1 from Controller class and placeholder id="PlaceHolder1" from View?


Solution

  • You can't use the asp placeholder control with ASP.NET MVC. Almost all controls require view state, which ASP.NET MVC doesn't support.