Search code examples
c#asp.nethtml.net-4.0runatserver

Can asp.net have <tbody id="blah" runat="server">?


I have a

<table>
    <tbody>..some stuff</tbody>
    <tbody id="sometimesHidden" runat="server">...</tbody>
</table>

But the .cs code says "The name 'sometimesHidden' does not exist in the current context" when I try to call sometimesHidden.Visible = false;.

Is it possible to get hold of the tbody in server side code?


Solution

  • Have you tried using the asp.net table control instead?

    Also is the table inside an other control that is a naming container like a formview or similar. If so the tbody is sort of out of scope and you have to do something like MyFormView.FindControl("sometimesHidden"); which will return a reference to it.