By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

control name change in asp.net 2.0 generated html

P: n/a
Hi all,

We have a user control that contains a DropDownList. This user
control appears on a web page. Suppose the name of the userControl on
the web page is called "ucLookup". Suppose the name of the
dropDownList within the user control is called "cboList".

On my development PC running VS2005 on WinXP Pro, the rendered HTML for
the dropDownList looks like this:

<select name="ucLookup:cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice that the name attribute contains a ':' (colon) between the
userControl name and the dropdownlist name.

On a production server running Windows Server 2003 and the .NET
framework installed from the redistributable, rather than from VS2005
(but still running the 2.0.50727 version), the rendered HTML is this:

<select name="ucLookup$cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice now that there is '$' character in the name of the control.
Between the two environments, the only major difference I can think is
the OS (WinXP Pro vs Windows Server 2003), and that the .NET framework
on Windows Server box was installed from the redistributable, rather
than from VS2005

Has anyone noticed this before? Is there any kind of environment
setting that controls the separater character which is used here?

--steve

Dec 8 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Steve:
I dung into it for you using reflector (you should try it out) and came to
this:

internal char IdSeparatorFromConfig
{
get
{
if (!this.EnableLegacyRendering)
{
return '$';
}
return ':';
}
}

as part of the control class
EnableLegacyRendering goes deeper, not 100% sure, but it seems like it might
be (a) config driven (do a google search for it and you'll find a few posts
about it from the Beta 2 days), or based on some other page properties.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"n33470" <n3****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi all,

We have a user control that contains a DropDownList. This user
control appears on a web page. Suppose the name of the userControl on
the web page is called "ucLookup". Suppose the name of the
dropDownList within the user control is called "cboList".

On my development PC running VS2005 on WinXP Pro, the rendered HTML for
the dropDownList looks like this:

<select name="ucLookup:cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice that the name attribute contains a ':' (colon) between the
userControl name and the dropdownlist name.

On a production server running Windows Server 2003 and the .NET
framework installed from the redistributable, rather than from VS2005
(but still running the 2.0.50727 version), the rendered HTML is this:

<select name="ucLookup$cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice now that there is '$' character in the name of the control.
Between the two environments, the only major difference I can think is
the OS (WinXP Pro vs Windows Server 2003), and that the .NET framework
on Windows Server box was installed from the redistributable, rather
than from VS2005

Has anyone noticed this before? Is there any kind of environment
setting that controls the separater character which is used here?

--steve

Dec 8 '05 #2

P: n/a
Just a bit more, based on
http://www.google.com/search?sourcei...tmlConformance

the default would be Transitional. Only when it's set to Legacy would I
expect it to use :

I realize this doesn't answer questions about the difference between your
two invironment, just hoping it'll let you find it out. Perhaps it's a
difference in the machine.config.

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:eD**************@TK2MSFTNGP14.phx.gbl...
Steve:
I dung into it for you using reflector (you should try it out) and came to
this:

internal char IdSeparatorFromConfig
{
get
{
if (!this.EnableLegacyRendering)
{
return '$';
}
return ':';
}
}

as part of the control class
EnableLegacyRendering goes deeper, not 100% sure, but it seems like it
might be (a) config driven (do a google search for it and you'll find a
few posts about it from the Beta 2 days), or based on some other page
properties.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"n33470" <n3****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi all,

We have a user control that contains a DropDownList. This user
control appears on a web page. Suppose the name of the userControl on
the web page is called "ucLookup". Suppose the name of the
dropDownList within the user control is called "cboList".

On my development PC running VS2005 on WinXP Pro, the rendered HTML for
the dropDownList looks like this:

<select name="ucLookup:cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice that the name attribute contains a ':' (colon) between the
userControl name and the dropdownlist name.

On a production server running Windows Server 2003 and the .NET
framework installed from the redistributable, rather than from VS2005
(but still running the 2.0.50727 version), the rendered HTML is this:

<select name="ucLookup$cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice now that there is '$' character in the name of the control.
Between the two environments, the only major difference I can think is
the OS (WinXP Pro vs Windows Server 2003), and that the .NET framework
on Windows Server box was installed from the redistributable, rather
than from VS2005

Has anyone noticed this before? Is there any kind of environment
setting that controls the separater character which is used here?

--steve


Dec 8 '05 #3

P: n/a
Karl,

Thanks for the info! Where is the property "EnableLegacyRendering"
implemented? In your code example, what is the context of 'this' in
the line of code: if (!this.EnableLegacyRendering)

The help docs for VS2005 do not mention this property, and there is
intellisense clue in either a derived UserControl, or Page class.

Where is that property implemented?

--steve

Dec 8 '05 #4

P: n/a
Steve:
My original email had all the details ;) It's an internal property of the
Control class. That's why you don't see it in the docs/intellisense and
can't access it. It's only visible through a dissassembler such as
reflector. The only way to answer these questions is to get into the guts
of stuff.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"n33470" <n3****@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Karl,

Thanks for the info! Where is the property "EnableLegacyRendering"
implemented? In your code example, what is the context of 'this' in
the line of code: if (!this.EnableLegacyRendering)

The help docs for VS2005 do not mention this property, and there is
intellisense clue in either a derived UserControl, or Page class.

Where is that property implemented?

--steve

Dec 8 '05 #5

P: n/a
the change was done to make the names legal, colon are allowed in html
identifies but dollar signs are not. a colon in a id tags specifies a
namespace so ms uses a underscore.

it a bug in your code if you used the actual names (from viewing the source)
instead of the ClientId property to get it.

to get the 2003 behaviuor, set the XhtmlConformanceSection to legacy
(produce non-compliant xhtml)
-- bruce (sqlwork.com)


"n33470" <n3****@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Hi all,

We have a user control that contains a DropDownList. This user
control appears on a web page. Suppose the name of the userControl on
the web page is called "ucLookup". Suppose the name of the
dropDownList within the user control is called "cboList".

On my development PC running VS2005 on WinXP Pro, the rendered HTML for
the dropDownList looks like this:

<select name="ucLookup:cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice that the name attribute contains a ':' (colon) between the
userControl name and the dropdownlist name.

On a production server running Windows Server 2003 and the .NET
framework installed from the redistributable, rather than from VS2005
(but still running the 2.0.50727 version), the rendered HTML is this:

<select name="ucLookup$cboList" id="ucLookup_cboList"
class="cboBodyNormal">

Notice now that there is '$' character in the name of the control.
Between the two environments, the only major difference I can think is
the OS (WinXP Pro vs Windows Server 2003), and that the .NET framework
on Windows Server box was installed from the redistributable, rather
than from VS2005

Has anyone noticed this before? Is there any kind of environment
setting that controls the separater character which is used here?

--steve

Dec 8 '05 #6

P: n/a
Bruce/Karl,

Thanks for the all the info!

This is not an issue with the use of ClientId, the error presented
itself as an issue with the Request.Forms variables posted back from
the web browser. Because the name attribute of the html tags is formed
differently amongst the xhtmlConformance mode settings, the posted
variable collection in Request.Forms had different contents. A
secondary issue that was corrected by this is that we have a huge
library of reusable testing scripts that do automated testing. The
automated test scripts use the rendered html for verification, and
because most of the tags rendered differently, it broke some of the
test scripts.

The following web.config setting fixed up the problems.

<xhtmlConformance mode="Legacy">

This setting was present on my development server because the ASP.NET
conversion wizard added it automatically to my web.config. However,
the setting was missing on the production server. The default
conformance mode, when there is no setting in the web.config, is
"Transitional".

Thanks again!

--steve

Dec 9 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.