문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top