Anil Namde Anil Namde - 1 year ago 80
Javascript Question

user controls in prefixing string to child controls causing problem to refer them in javascript

I have user control in which there are text boxes no i am using the AJAX to populate the child controls dynamically however appending some string to child controls causing problems to write the JavaScript code.
Though i have tried getElementLike('key') which iterate elements and get the right one for me but this is really inefficient. So if anybody has any insight on this issue please provide you input/suggestions.

Thanks all,

Answer Source

Look at using someControl.ClientId, which will give you the ASP.NET generated id of the control. Using this Id you will be able to correctly target the element via javascript.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download