This is a migrated thread and some comments may be shown as answers.

JQuery and UserControl

5 Answers 170 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 08 Apr 2012, 04:11 PM
Hi:

I have a user-controls that is dragged inside a RadAjaxPanel.  The JQuery code in the user-conde does not seem to run.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DisplayMessage.ascx.cs" Inherits="Telerik.UserControls.DisplayMessage" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
        //<![CDATA[
        $(document).ready(function () {
            alert("here uc");
        });
        ]]>
    </script>
</telerik:RadScriptBlock>
I have remove any work from the jquery, and reverted to alerts, but the alert does not appear.

Phil

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 11 Apr 2012, 02:36 PM
Hello,

Note that $(document).ready function does not executes after ajax request which is generic framework behaviour. I would suggest you to use the client pageLoad event to execute the needed code in ajax scenarios.

Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Phil
Top achievements
Rank 2
answered on 12 Apr 2012, 08:18 PM
Hi:
I figured out that the life cycle of the $(document)ready function was different than what I expected.  I have a neat funtionality that is currently broken via ajax and page load is not the solution.
Phil
0
Phil
Top achievements
Rank 2
answered on 13 Apr 2012, 05:04 PM
Hi:
Do you have a blog post or a helper document per working with javascript and specifically JQuery and RadAjaxPanel?
Phil
0
Phil
Top achievements
Rank 2
answered on 15 Apr 2012, 03:46 AM
Hi:
Per another forum post, I figured a workaround:
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="100%"
                    ClientEvents-OnResponseEnd="pnlOpen" >
was a major step.  But I also had to apply various client-side events:
$("#pnl").bind("click", pnlClose);
and:
pnl.Attributes.Add("OnClick", "return pnlClose();")

Phil
P.S. Read Kevin Babcock's response.
0
Accepted
Maria Ilieva
Telerik team
answered on 17 Apr 2012, 09:50 AM
Hello,

I'm glad that you have mentioned to find solution provide by out community.
Do not hesitate to contact us back if any RadControls related issues appear in future.

Greetings,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Phil
Top achievements
Rank 2
Answers by
Maria Ilieva
Telerik team
Phil
Top achievements
Rank 2
Share this question
or