Reputation:
The button is derived from user control. I want to associate a pop-up window on click of that particular butoon. I can able to achieve this on click of anyother buttons on my base page but as that particular button is coming from a user control I am not able to trigger the pop-up window.
$('#btnSendOrder').click(function() {// code here}) // btnSendOrder is from a user control.In this case pop-up is not coming.
$('#btnSendOrder').click(function() { // code here}) // btnSend Order is from the base page itself. In this scenario pop-up comes out.
Upvotes: 0
Views: 2620
Reputation: 81874
Since the button is being rendered on the server, its client ID is not what you are using
You can do this...
$('#<%= btnSendOrder.ClientID %>').click(function() {// code here})
... from your usercontrol, and the portion between <% and %> will be replaced with the real control id in the client html
Upvotes: 1
Reputation: 15754
If you are using .NET, reember that your controls will end up looking something like: ctl1.UserControlName.ButtonName or something like that.
Check your markup code once it is rendered, then use the exact button name so that your jQuery knows which control to fire from.
Upvotes: 0
Reputation: 33857
Using a bit of jquery, it would be relatively trivial to associate the button with a click event on load of the page:
$(".button").click(function() {
PopupMyWindow();
});
Upvotes: 0