How to open a new appointment using code behind

7 posts, 0 answers
  1. Khoa Ho
    Khoa Ho avatar
    9 posts
    Member since:
    Feb 2009

    Posted 15 Sep 2010 Link to this post

    Hi,

    I want to open a new appointment dialog using code behind or javascript, not clicking on the scheduler. I have played around with that but see no luck.

    The scenario is that when I click on an external button outside the scheduler, it will open a new appointment dialog with current date.

    Thanks,

    Khoa
  2. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 21 Sep 2010 Link to this post

    Hello Khoa Ho,

    The solution is similar to this help topic. You need to subscribe to the OnClientTimeSlotClick and use the showAllDayInlineInsertForm method. Here's the code:

    Javascript:
    function insertAppointment() {
                var now = new Date();
                var scheduler = $find("<%= RadScheduler1.ClientID %>");
                scheduler.showAllDayInlineInsertForm(now);
            }

    ASPX:
    <input type="button" name="button1" value="Create Appointment" onclick="insertAppointment()" />

    Hope this helps.

    Best wishes,
    Veronica Milcheva
    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. Khoa Ho
    Khoa Ho avatar
    9 posts
    Member since:
    Feb 2009

    Posted 21 Sep 2010 Link to this post

    Thank you Veronica,

    It's still not working. I got this error from Firebug: d("div.rsTopWrap table.rsContentTable", m)[0].tBodies[0].rows[j] is undefined

    Thanks,

    Khoa
  4. Veronica
    Admin
    Veronica avatar
    1213 posts

    Posted 24 Sep 2010 Link to this post

    Hello Khoa Ho,

    In the ticket info I see you are using version 2010. 2 826. Is that true?

    Could please send me the full code so I can inspect it and help you?

    Thank you!

    Kind regards,
    Veronica Milcheva
    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
  5. Wayne Wilson
    Wayne Wilson avatar
    4 posts
    Member since:
    Mar 2004

    Posted 22 Feb 2013 Link to this post

    I am trying to open the new Appointment dialog from a button/or link outside of the RadScheduler. (I also want to edit from a RadGrid listing of said appointments, but I haven't got that far yet). I am still using Q1 2012.

    I tried the javascript included in this post (with the RadScheduler name updated) and it doesn't seem to work for me. Is this still the best way to do that in my version? I an new the the RadScheduler and am having a hard time completing what I thought would be a rather easy task...

    Thanks,

    --Wayne
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 25 Feb 2013 Link to this post

    Hello Wayne,

    Please try the following code which works fine for me in Q1 2012 version. Attach the following JavaScript function to the OnClientClicked event of the RadButton. Also you need to set the AutoPostBack property of the RadButton to false.

    ASPX:
    <telerik:RadButton ID="RadButton1" runat="server" AutoPostBack="false" Text="Create Appointment" OnClientClicked="insertAppointment"></telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function insertAppointment() {
            var now = new Date();
            var scheduler = $find("<%= RadScheduler1.ClientID %>");
            scheduler.showAllDayInlineInsertForm(now);
        }
    </script>

    Thanks,
    Princy.
  7. Wayne Wilson
    Wayne Wilson avatar
    4 posts
    Member since:
    Mar 2004

    Posted 26 Feb 2013 Link to this post

    Thanks, I will check that out. It might have been the post-back that was messing me up.

    --Wayne
Back to Top