Saturday, March 24, 2012

Naming Convention to search for a control with $get

Is there another way to find a control when using a master page and a tabContainer ?

For now I'm using the following syntax in Ajax client script:

$addHandler($get("ctl00$myContentPlaceHolder$myTabContainer$myTab1$txtPostalCode"), "keyup",mapPostalCode);

It's a little long, no ??

Thank you !

Gerrie

I usually embed the control.ClientID in a javascript variable if I need it, like so:

var txtPostalCode = "<%= txtPostalCode.ClientID %>";

Note this only works (afaik) inside on-page script tags or in an embedded .js file (from an assembly), or in a registered script block.


Great!

$addHandler($get("<%= txtPostcalCode.ClientID %>"),"keyup", mapPostalCode);

it works !!!

Thanks for this little annoying problem... sometimes little things keep me awake :-)

No comments:

Post a Comment