Solved

using jquery loaded usercontrol codebehind

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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.
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now