.net Changing $ to _ ?

  • Thread starter Thread starter Paulo
  • Start date Start date
P

Paulo

The GridView is generating the radios name with $ on the source page, like:
"ctl00$Contentplaceholder2$grdContratos$ctl02$radioSimNao", but when I pass
the jsFunc(RadioButton.clientID) on .net code it is generating:
"ctl00_Contentplaceholder2_grdContratos$ctl02_radioSimNao", so the js doesnt
find the component...

What can I do?

Thanks

VS 2005 asp.net 2.0 C#
 
There are 2 IDs one is ClientID another UniqueID. You can use UniqueID for
your case.

PS: Kills me too. I thought the ClientID is the one I must be using.....
 
ms went down a rat hole with names and ids. they started with ":" as
separator, but found this was illegal in an id or name, so replaced it
"$". then they realized "$" was illegal in an id when they wanted xhtml
compliance, so they changed it to "_" in an id.

so:

ClientId is the controls id (getElementById()), separator "_"
UniqueId is the controls name (getElementsByName()), separator "$"

note: starting an id with an "_" is not valid w3c html/xhtml, but they
still do it.

-- bruce (sqlwork.com)
 
Back
Top