tags:

views:

50

answers:

1

I have an ASP.NET Usercontrol and am using JQuery to do some stuff for me. I use the User control dynamically in different pages. I need to get the ControlID of the control that is in the user control. How do i dynamically do a $('#myControl') instead if $('#HostPage.myControl'), what is the syntax for $('<%#myControl.ControlID'%>), or can I do this.

+2  A: 

Should be

$('#<% = myControl.ClientID %>')

$("[id$='myControl']") might also work - that'd find you an element with an ID that ends with myControl.

Kobi
$('#<% = myControl.ClientID %>') is not working. ANy reasons?
Greens
Thanks for the answer
Greens