I'm looking at some site code on an XHTML doctype and from what I'm seeing the framework is ASP.net. The IDs in the HTML has a "$" in there.
For example:
<img id="$ct100templateContent$SectionPanel1$ctl01$ctl02ctl00_templateContent_SectionPanel1_ctl01_ct999img" src="this.jpg"/>
From a W3C semantic point of view the "$" is not valid in an ID or Class. IDs and classes can only contain alpha numeric characters in an XHTML doctype.
Is the the "$" a ASP.net naming convention referencing a web control or template item?
The $value stands for the level of which the control is embedded in your site/page. You can also change ClientIDMode to Static to make use of your own ID's.
I'm a little confused how/why you're seeing dollar signs in the id.
When rendering a Web control into markup, ASP.NET generates the element's
id
andname
attributes based on the Web control'sID
property and its location in the control hierarchy. In short, certain controls - such as templated controls or repeating controls - act as naming containers. Such controls'ID
property values are prefixed to their inner controls'ID
property values when determining theid
andname
attributes.For example, consider the following control hierarchy:
Here, the Master Page (
ctl00
) and ContentPlaceHolder (MainContent
) controls are naming containers. TheAge
TextBox Web control will have a renderedid
ofclt00_MainContent_Age - namely, its own server-side
IDproperty value prefixed with the
ID` values of its naming container ancestors.But note how the rendered
id
is separating each naming container spot with an underscore. This is the default functionality in ASP.NET, so I am perplexed as to why you are seeing dollar signs in theid
attribute. (When formulating thename
attribute, ASP.NET separates each naming container spot with a dollar sign, but it shouldn't use $ when formulating theid
attribute value.)What version of ASP.NET are you using? Are you doing anything... weird? Like using custom controls and overriding the base
Control
class'sIdSeparator
property? If you are using ASP.NET 4, are you setting (either intentionally or unintentionally) the control'sClientIDMode
property?Yes, ASP.NET uses the '$' symbol when it generates the IDs of controls based off the hierarchical page layout. ASP.NET does not use the '$' symbol in class names.