In my aspx page, I have the following code to generate a asp:Table
abc.aspx
<asp:Table id = "_tableTest" runat="server"></asp:Table>
When I render it on the page , I need the id to be prepend with a text , for example "Address"
<table id="Address_tableTest" > </table>
How can I customize the ID generation? I couldnt find relevant documentation.
2
Answers
You can append it.
what is the use of Eval() in asp.net
Yes @VDWWD is correct Id can not be set dynamically
It is explained here in this post Eval script for server side control’s ID property
What do you mean? If some 3rd party needs the table name, then you can’t change it. I mean, either you type in Address_tableTest as the ID, or you don’t.
The "id" is NOT generated for you, YOU the developer type it into the markup
You can change the "id" in the forms pre-render event.
In fact, you can even change it in the page on-load event.
or
The "id" in markup will now thus render and use "abc".
However, code behind will continue to use "this.GridView1" to reference the control.