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

RadAjaxManager: Javascript breaks after event

2 Answers 71 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
David O'Leary
Top achievements
Rank 2
David O'Leary asked on 12 Apr 2012, 05:02 AM
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 Answers, 1 is accepted

Sort by
0
David O'Leary
Top achievements
Rank 2
answered on 12 Apr 2012, 10:57 PM
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)");
    }
0
Eyup
Telerik team
answered on 13 Apr 2012, 08:46 AM
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.
Tags
Ajax
Asked by
David O'Leary
Top achievements
Rank 2
Answers by
David O'Leary
Top achievements
Rank 2
Eyup
Telerik team
Share this question
or