html - How to reference the parent element in the DOM in an ASPX page? -


here's page snippet:

... <asp:content id="main" contentplaceholderid="placeholdermain" runat="server">   <table>     <tr>       <td>         <asp:textbox maxlength="255" id="mytextbox" runat="server"></asp:textbox>       </td>     </tr>   </table> </asp:content> ... 

and here's page code-behind piece:

... control parent = this.mytextbox.parent; //this acutally asp:content control string parentid = parent.id; //this placeholdermain ... 

what need reference <td> element (because want change it's visibility property). how can achieve this? did go horribly wrong? :)

add attribute runat <td> tag other users suggested.

<td id="mytd" runat="server">    <asp:textbox maxlength="255" id="mytextbox" runat="server"></asp:textbox> </td> 

then in c# side (page back)

add header file

using system.web.ui.htmlcontrols; protected void button_click(object sender,eventargs e) {   mytd.attributes.add("style","visibility:none"); } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -