开发者

FindControl table cell

I want to reference a table cell via it's string ID in my code like this FindControl("tdAnswer_a") because I am manipulating string ID names. The ASPX code looks like this :

<table>...<td ID="tdAnswer_a" runat="server" visible="true">

But FindControl is not able to find the table cell. When I reference it by ID like this :开发者_C百科 tdAnswer_a.Visible = true; in my codebehind, it has no problems. (This is not part of a repeater or gridview).

How can I FindControl my table cells via string ID names?


FindControl is not a recursive function. If they are inside of some other container control, and you call FindControl on the Page object, then they won't be found.

You need to call FindControl on the direct container, or else write a recursive FindControl function.

You can see a version of a recursive FindControl in my old answer here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜