RadAjaxManager: Javascript breaks after event

3 posts, 0 answers
  1. David O'Leary
    David O'Leary avatar
    19 posts
    Member since:
    Jul 2005

    Posted 12 Apr 2012 Link to this post

    I've got some Javascript bound to the click event for a bunch of buttons in an asp:repeater representing time slots. Once the buttons are updated through the RadAjaxManager, the Javascript no longer works. If I remove the RadAjaxManager stuff (so it does full PostBacks), it works fine. I've tried moving the Javascript into various places. I've tried using .on rather than just binding .click directly but can't seem to make it work.

    jQuery(function($) {
                $(".SelectScheduleDate").on("click", selectTime);
    }

    Any thoughts on what I need to do differently?

    David
  2. David O'Leary
    David O'Leary avatar
    19 posts
    Member since:
    Jul 2005

    Posted 12 Apr 2012 Link to this post

    I figured this out. I just needed to add the binding call as a ResponseScript to the PageLoad

       protected void Page_Load(object sender, EventArgs e)
      {
        if (!IsPostBack)
        {
           //do stuff
        }
        RadAjaxManager1.ResponseScripts.Add("$('.SelectScheduleDate').click(selectTime)");
        }
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eyup
    Admin
    Eyup avatar
    3007 posts

    Posted 13 Apr 2012 Link to this post

    Hi David,

    I'm glad you solved the issue by yourself. Please feel free to contact us if you have further questions.

    Greetings,
    Eyup
    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