Solved

using jquery loaded usercontrol codebehind

Posted on 2014-09-21
2
217 Views
Last Modified: 2014-09-21
We use the jquery to load a usercontrol using page webmethod. It works. But the controls inside the usercontrol do not fire events anymore.
0
Comment
Question by:Deraldo Silva
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40335521
instead using (for example) :
$("#<%= Button.ClientID %>").click(function() {
use :
$(document).on("click", "#<%= Button.ClientID %>", function() { // since jQuery 1.9
or :
$("#<%= Button.ClientID %>").live("click",  function() { // before jQuery 1.9

more info :
http://api.jquery.com/on/#direct-and-delegated-events
Event handlers are bound only to the currently selected elements; they must exist on the page at the time your code makes the call to .on()....delegated events have the advantage that they can process events from descendant elements that are added to the document at a later time.

http://api.jquery.com/on/
http://api.jquery.com/live/
0
 

Author Closing Comment

by:Deraldo Silva
ID: 40335764
thx. I got it.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now