Exporting Appointments When Client-Side Binding

9 posts, 0 answers
  1. Brian Mains
    Brian Mains avatar
    485 posts
    Member since:
    Oct 2008

    Posted 21 May 2010 Link to this post

    Hello,

    Do you have an example of how appointments get exported when bound to a web service?  I'm updating my code to use the WS approach and my previous setup didn't work (which, or course, was exporting the ICS from the server).

    Thanks.
  2. Dimitar Milushev
    Admin
    Dimitar Milushev avatar
    555 posts

    Posted 27 May 2010 Link to this post

    Hello Brian,

    We do not have such an example available. The ExportToICalendar method is static and you don't need a Scheduler instance to use it. You can use it to create a method in your webservice that builds the ICS file using the same approach used in the code-behind of our Export demo.

    Best wishes,
    Dimitar Milushev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jim
    Jim avatar
    7 posts
    Member since:
    Oct 2012

    Posted 29 Mar 2011 Link to this post

    Boy, It would help me a ton to see some kind of sample code on how to do this.  Please...
    Most important example being how to add the button to the Appointment. All I need is to capture the appointment Id to the onclick event. onclick="Export(this,' " + $AppId + " '); return false;".  I can do the rest on the backend/ 
    <script id="tmplApptExtended" type="text/x-jquery-tmpl">
                <div style='font-style:italic;'>
                    <b>${ApptName}</b>
                    <h3>${ApptType}</h3>
                    <h3>${Location}</h3>
                </div>
                <div style="text-align: right;">
                    <input id="btnICal" type="button" value="button" onclick="Export(this,event); return false;" Style="cursor: pointer; cursor: hand;" />
                </div>
            </script>
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 01 Apr 2011 Link to this post

    Hi James,

    Please, refer to the Web Service demo. You can get the appointment object with the scheduler.getAppointmentFromDomElement() method. Note, that you will need the new plugin for jQuery - Templates.


    Greetings,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Jim
    Jim avatar
    7 posts
    Member since:
    Oct 2012

    Posted 01 Apr 2011 Link to this post

    Thanks,
    But I don't think I explained my problem correctly which is, how do you add the export button to the appointments on a scheduler that is bound using webservices.

    The following code works great just need to see example on how to add the export button -  I think this is simple but I am just not seeing:
    <script id="tmplApptExtended" type="text/x-jquery-tmpl"
      <div style='font-style:italic;'
        <b>${ApptName}</b
        <h3>${ApptType}</h3
        <h3>${Location}</h3
      </div
    </script>

     

     

    function OnClientDataBound(scheduler) {
                    var $ = jQuery;
                    $(".rsAptDelete").each(function() {
                        var appt = scheduler.getAppointmentFromDomElement(this);
                        // creating an object containing the data that should be applied on the template
                        var attributes = appt.get_attributes();
                        //var desc = appt.get_description();
                        var apptName = attributes.getAttribute("ApptName");
                        var apptType = attributes.getAttribute("ApptType");
                        var location = attributes.getAttribute("Location");
                        var tmplValue = { ApptName: apptName, ApptType: apptType, Location: location};
                        // instantiate the template, populate it and insert before the delete handler (".rsAptDelete")
                        $("#tmplApptExtended").tmpl(tmplValue).insertBefore(this);
                    });
                }

     

     

  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 07 Apr 2011 Link to this post

    Hello James,

    Here is one possible way to get the id of the appointment:

    <%--<Templates>--%>
       <script id="tmplApptExtended" type="text/x-jquery-tmpl">  
         <div style='font-style:italic; color:green'>  
           <input id="Button2" type="button" value="button"  onclick="Export(${ApptID})"  />
         </div>  
       </script>
       <%--</Templates>--%>
       <script type="text/javascript">
            
           function Export(e) {
               alert(e);
           }
           function onSchedulerDataBound(scheduler) {
               var $ = jQuery;
               $(".rsAptDelete").each(function () {
                   var appt = scheduler.getAppointmentFromDomElement(this);
                    
                   var apptID = appt.get_id();
                   var tmplValue = { ApptID: apptID };
                   // instantiate the template, populate it and insert before the delete handler (".rsAptDelete") 
                   $("#tmplApptExtended").tmpl(tmplValue).insertBefore(this);
               });
           }
       </script>


    Best wishes,
    Peter
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Jim
    Jim avatar
    7 posts
    Member since:
    Oct 2012

    Posted 07 Apr 2011 Link to this post

    Very Nice! So So simple.  Thanks
  9. Prava kafle
    Prava kafle avatar
    212 posts
    Member since:
    Apr 2010

    Posted 30 Aug 2013 Link to this post

    Hi,

    I have a webservice bound scheduler too and I am getting "undefined is not a fxn " error  on $(".rsAptDelete").each(function()
    Am I missing anything here?

    Thanks,
    Prava
  10. Plamen
    Admin
    Plamen avatar
    2731 posts

    Posted 03 Sep 2013 Link to this post

    Hi Prava,

     
    You can refer to this Code Library where this functionality  is implemented.

    Hope this will be helpful.

    Regards,
    Plamen
    Telerik
    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 the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017