How to find out control's name?
Hi there!
Is there anyway to know the runtime names/IDs displayed in the browser of the controls used in datagrids, generated by ASP.NET engine?
For ex:
Suppose if we use the following code to generate a datagrid
Code:
<Columns>
<asp:TemplateColumn HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "ID") %>' />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
The HTML output would be somewhat like this:
Code:
<span id="dgrid__ctl2_lblID">1</span>
Here is my question. In the ASP.Net coding, can I reference/know the HTML control [which are output] names of the WebControls that I used in my page?
In the above example, 'lblID' ==> 'dgrid__ctl2_lblID'
I want to refer/use 'dgrid__ctl2_lblID' in the ASP.NET code.
Hope I am clear. If not, please let me know.