Solved

using jquery loaded usercontrol codebehind

Posted on 2014-09-21
2
221 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

840 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