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

10 posts, 0 answers
  1. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 22 Sep 2011 Link to this post

    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
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 22 Sep 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 22 Sep 2011 Link to this post

    Hi Peter,
    Thanks for quick response. It was a magic pill, solved my problem in a sec.

    Once agian, thank you very much!
    Prava
  5. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 27 Sep 2011 Link to this post

    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
  6. Vipin
    Vipin avatar
    3 posts
    Member since:
    Sep 2011

    Posted 30 Sep 2011 Link to this post

    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

     

  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 30 Sep 2011 Link to this post


    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
  8. Kevin Salerno
    Kevin Salerno avatar
    1 posts
    Member since:
    Dec 2009

    Posted 03 Jan 2012 Link to this post

    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
  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 04 Jan 2012 Link to this post

    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
  10. Nagesh
    Nagesh avatar
    1 posts
    Member since:
    Aug 2014

    Posted 21 Aug 2014 in reply to Peter Link to this post

    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.
  11. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 26 Aug 2014 Link to this post

    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.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017