Question

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?

Was it helpful?

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.

OTHER TIPS

The answer is yes, it can.

However, sometimes, the codebehind has problems picking up controls on the page.

Take out your logic that references, run the project, and then try again.

If all else fails, you can include the reference yourself by hitting the .designer.cs file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top