0

I have a simple HTML table with a caption for it and thw caption showed.I add a runat="server" attribute to it and now the caption did not show. How I can show caption for table that is runat="server" .

Edit 1)

<table cellpadding="4" cellspacing="0" id="tbl_9_10" runat="server" clientidmode="Static" >
                    <caption>
                        For Six years old </caption>
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Arian
  • 12,793
  • 66
  • 176
  • 300
  • Why do you want that `runat=server` here? What are you trying to achieve? Maybe there are other solutions where you can have the server-side elements plus the rich table model client-side. – Hans Kesting May 08 '12 at 09:01

1 Answers1

3

From MSDN "A complex table model is not supported. You cannot have an HtmlTable control with nested caption, col, colgroup, tbody, thead, or tfoot elements."

Instead you can use asp.net table

<asp:Table Caption="For Six years old" runat="server">

</asp:Table>
Prashanth Thurairatnam
  • 4,353
  • 2
  • 14
  • 17
  • asp:Table appearently doesn't support colgroup. Are there any workarounds? – Gqqnbig Dec 29 '16 at 19:05
  • @LoveRight unfortunately by design with asp.net webforms there is no straight forward solution for this. I am not sure on the version of .net framework used in your application. There are few suggestions for you. Use pure HTML table and use javascript/jquery to bind data. Depending on the .NET version you may opt for ASP.NET Web API. Alternatively if you are starting something new why not switch to ASP.NET MVC (I know in most cases this is not possible; again this depends on your situation). Write your own server control to accommodate the requirements (not straight forward) – Prashanth Thurairatnam Dec 30 '16 at 09:43
  • @LoveRight you may want to check this SO thread http://stackoverflow.com/questions/12500332/html-table-tag-with-col-colgroup-tbody-and-thead-throws-compile-error-in-visu – Prashanth Thurairatnam Dec 30 '16 at 09:44