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

Need client side fxn called by save/close and cancel button on appointment Edit Form

9 Answers 122 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Prava kafle
Top achievements
Rank 1
Prava kafle asked on 22 Sep 2011, 02:04 PM
Hi,

I need to call javascript fxn on clicking "Save/Cancel/Close" button on Appointment EditForm. Currently, when I hit Save/Cancel button it  causes post back. How can I capture the client side event for these buttons? On clicking "X' on appointment edit form, it just closes the form, need to call javascript fxn on clicking close button.

Any idea?
Thanks
Prava

9 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 22 Sep 2011, 03:33 PM
Hello Prava,

Please, refer to this help topic -
http://www.telerik.com/help/aspnet-ajax/scheduler-customizing-advanced-form-javascript-jquery-css.html.

The end part of the id of the rendered link for the cancel button is "CancelButton" so you can use it to get the jQuery object of it and attach on its onclick event.

Best wishes, Peter
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
Prava kafle
Top achievements
Rank 1
answered on 22 Sep 2011, 04:08 PM
Hi Peter,
Thanks for quick response. It was a magic pill, solved my problem in a sec.

Once agian, thank you very much!
Prava
0
Prava kafle
Top achievements
Rank 1
answered on 27 Sep 2011, 05:18 PM
Hi Peter,
 I  handled the click event for cancel, close and save buttons in advanced edit form   using javascript but I cannot close it if I cancel post back. Is there a way to close this form from client side? On clicking  Save button, I also want to get all arguments from this form, how can I get it?



   var advancedEditCancelButton = $telerik.$("[id$='Form_CancelButton']");          
                   advancedEditCancelButton.click(CloseAdvancedForm);

                   var advancedEditCloseButton = $telerik.$("[id$='Form_AdvancedEditCloseButton']");        
                   advancedEditCloseButton.click(CloseAdvancedForm);
                  
                  var advancedEditUpdateButton = $telerik.$("[id$='Form_UpdateButton']");
                  advancedEditUpdateButton.click(SaveAdvancedApptEditForm);
                 


  function CloseAdvancedForm(sender, eventArgs) {
                   var advancedEditForm = sender.get_AdvancedEditForm();
                   advancedEditForm.close();
                   eventArgs.set_cancel(true);
               }
                    
               function SaveAdvancedApptEditForm(sender, e) { 
                    var apptScheduler = new Appt_Scheduler();
                   apptScheduler.checkforConflictToRescheduleAppointment(e);
                   var advancedEditForm = sender.get_AdvancedEditForm();
                   advancedEditForm.close();
                   e.set_cancel(true);
              }
Thanks,
Prava
0
Vipin
Top achievements
Rank 1
answered on 30 Sep 2011, 10:52 AM
Hi Prava,

I have the same problem. I am able to get the advanced form values from the code behind by using'AppointmentUpdate' event. But my requirement is to find the values through client-side code. I need something like this,

<

telerik:RadScheduler ID="RadScheduler1" runat="server" onClientAppointmentUpdate="SaveFormValues">

<   script type="text/javascript">


function
SaveFormValues() {

var saveButton= $find('<%=RadScheduler1.SaveButton.ClientID %>');  

}

</script>

Please help me to find a solution... :(

Thanks & Regards,
ViPiN.P.C

 

0
Peter
Telerik team
answered on 30 Sep 2011, 03:21 PM

Here is one possible solution:
<script type="text/javascript">
 
      var targetTimeSlot = null;
      var targetAppointment = null;
 
      function OnClientAppointmentInserting(sender, args) {
          targetTimeSlot = args.get_startTime();
      }
      function OnClientAppointmentEditing(sender, args) {
          targetAppointment = args.get_appointment();
      }
      function InsertHandler() {
          //Perform custom logic with targetTimeSlot
          //***
          targetTimeSlot = null;
      }
      function EditHandler() {
          //Perform custom logic with targetAppointment
          //***
          targetAppointment = null;
      }
  </script>
  <telerik:RadScheduler runat="server" ID="RadScheduler1" OnClientAppointmentEditing="OnClientAppointmentEditing"
      OnClientAppointmentInserting="OnClientAppointmentInserting">
  </telerik:RadScheduler>


All the best, Peter
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
Kevin Salerno
Top achievements
Rank 1
answered on 04 Jan 2012, 04:41 AM
I am also looking for a solution to close the Advanced Edit form on the client.  Did you end up getting a work around?

Regards,

Scott
0
Peter
Telerik team
answered on 04 Jan 2012, 10:25 AM
Hi Kevin,

You can use the hideAdvancedForm() method.
function hideAdvancedForm() {
         var scheduler = $find('<%=RadScheduler1.ClientID %>');
         scheduler.hideAdvancedForm();
     }


Kind regards,
Peter
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
Nagesh
Top achievements
Rank 1
answered on 21 Aug 2014, 07:47 PM
Hello Peter,

I tried to do the same solution as the Cancel button was taking too long time to close. It hides the form from the page but unfortunately whenever there is a next post back it just opens the Advanced Edit form again.

Please let me know if we have found any solution to the slowness of the Advanced Edit Form.
0
Bozhidar
Telerik team
answered on 26 Aug 2014, 07:13 AM
Hi,

If your requirement is performance, I would suggest using WebService binding, demonstrated in the following demo:
http://demos.telerik.com/aspnet-ajax/scheduler/examples/webservice/defaultcs.aspx

Regards,
Bozhidar
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Scheduler
Asked by
Prava kafle
Top achievements
Rank 1
Answers by
Peter
Telerik team
Prava kafle
Top achievements
Rank 1
Vipin
Top achievements
Rank 1
Kevin Salerno
Top achievements
Rank 1
Nagesh
Top achievements
Rank 1
Bozhidar
Telerik team
Share this question
or