accessing the web user control through jquery on the web form page

553 views Asked by At

I'm building a web user control for ASP.NET. on the main aspx page where I place the user control and I give it an id. the problem is I want to access it by using Jquery(I have the plugins), but the element of the web user control is "undefined", the jquery works on all the other elements of the web forms page except the web user control that I made.

    $(document).ready(function () {
        alert($('#userControl').prop('ID')); //returns undefined
    });
1

There are 1 answers

1
FleGMan On

Are you sure you are using the right ID to select your control? Try using something like this:

var userControllId = "<%=userControll.ClientID %>"

That's the correct way to get a user control ID from jQuery