JQuery and UserControl

6 posts, 1 answers
  1. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 08 Apr 2012 Link to this post

    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
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 11 Apr 2012 Link to this post

    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.
  3. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 12 Apr 2012 Link to this post

    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
  4. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 13 Apr 2012 Link to this post

    Hi:
    Do you have a blog post or a helper document per working with javascript and specifically JQuery and RadAjaxPanel?
    Phil
  5. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 14 Apr 2012 Link to this post

    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.
  6. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 17 Apr 2012 Link to this post

    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.
Back to Top