.NET renaming my controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to tell the VS2005 IDE NOT to rename my controls on a build?

if my control name is txtDate, the rendered version of the page has the
control as crtl01_txtDate.

This poses a big problem when you have client Javascript on the page needing
to references the original control Name. I understand MS reasons to fully
qualify Names, but this should be left up to the user.

The person next to me is developing a different project in VS2005, and their
builds do not rename the controls.

Can I turn this off?
 
Never heard of this "special feature" excuse the pun but it sounds like a
virus or another programmer playing games. Then again I could very well be
off on my guess here.
 
I have discovered this only occurs when the Web control is part of ASCX user
control. If the control is placed inside the ASPX then it won’t rename it.

try it :o)

Still annoying as heck. Makes it almost impossible to write reliable
javascript. I coded it the way I wanted it. MS need to leave html code/
javascript the heck alone. Front Page does the same thing sort of with other
items.

--
JP
..NET Software Developer


Kevin S Gallagher said:
Never heard of this "special feature" excuse the pun but it sounds like a
virus or another programmer playing games. Then again I could very well be
off on my guess here.
 
JP said:
I have discovered this only occurs when the Web control is part of ASCX user
control. If the control is placed inside the ASPX then it won’t rename it.

This is because you could have multiple instances of the control on a page
and so the web control's individual controls are renamed to
ControlInstanceName_ControlName.

If you want to get the client side name use the control's ClientID property,
something like:

<script language="javascript">
alert ("Control value is " + form1.<%=txtControlName.ClientID%>.value);
</script>

HTH
 
Back
Top