Using advanced edit templates

7 posts, 0 answers
  1. Jostein
    Jostein avatar
    16 posts
    Member since:
    Oct 2011

    Posted 09 Jan 2012 Link to this post

    I am using a RadScheduler, and have some issues. I cant seem to get rid of the edit templates. What i have done is, in the OnClientAppointmentDoubleClick event, i do some custom Javascript code. I want only this code to run, and dont want to see any edit templates etc from the telerik control. But when i run this, the template for editing is displayed when i double click an appointment. How can I avoid this? I have set AllowEdit="False", but that does not seem to help. And i cannot catch the AppointmentEditingEvent from this post:http://www.telerik.com/community/forums/silverlight/scheduler/how-to-disable-some-features-of-radscheduler.aspx
    for 2 reasons:
    1. I still want the user to be able to expand an item by clicking and dragging.
    2. There IS NO SUCH EVENT on the Scheduler control.

    How can I disable the edit template showing up when double clicking an appointment?


    What I actually want to do is:
    - User double clicks an appointment
    - Hide scheduler
    - Show a hidden panel
    - Put ID, subject, start and end of the clicked appointment into textboxes inside the new panel

    And I would like this panel to be TOTALLY INDEPENDANT of the Scheduler. Possible? 
  2. Richard
    Richard avatar
    479 posts
    Member since:
    Nov 2011

    Posted 09 Jan 2012 Link to this post

    Jostein:

    If you're using RadScheduler in ASP.NET AJAX application, you should be able to disable/override the EditTemplate by following the instructions on the Replace the Edit Form documentation page for RadScheduler. I believe the event to catch is the OnClientAppointmentEditing.

    Hope this helps.

    Regards,
  3. Jostein
    Jostein avatar
    16 posts
    Member since:
    Oct 2011

    Posted 11 Jan 2012 Link to this post

    Well, as far as i know, that would replace the edit template and then use the buildt in functionality. I do not want this. I want to DISABLE any functions on a doubleclick on an appointment, and then add my own. But if i add an ajaxrequest to the double click event (Java), it STILL shows me the edit template. How can i avoid this?

    My problem is actually:
    I have added a RadAjaxManager to my page. On a double click on an appointment, i fire this javascript function:
    function schedulerDblClick(sender, args) {
     
         $find('<%= RadAjaxManager1.ClientID %>').ajaxRequest(args.get_appointment().get_id());
     
    }

    My Scheduler is defined like this:

    <telerik:RadScheduler ID="RadSchedulerProScreen" runat="server" Skin="ProScreen" EnableEmbeddedSkins="false" AllowEdit="false" AllowInsert="false" AdvancedForm-Enabled="false"
    FirstDayOfWeek="Monday" LastDayOfWeek="Sunday" SelectedView="WeekView" ShowFooter="False" ShowAllDayRow="false" OnClientAppointmentDoubleClick="schedulerDblClick"
    ShowHeader="False" DisplayDeleteConfirmation="false" ShowFullTime="false" WeekView-WorkDayStartTime="06:00:00" WeekView-WorkDayEndTime="20:00:00" WorkDayStartTime="06:00:00" WorkDayEndTime="20:00:00">
    <TimelineView UserSelectable="False" />
    <DayView UserSelectable="False" />
    <MonthView UserSelectable="False" />
    </telerik:RadScheduler>


    But when i now double click an item, the following happens:
    - The javascript function fires
    - The codebehind function does not fire (Private Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest)
    - The small inline editor for changing the subject only pops up in the scheduler.


    How can I disable the editor, and fire my own function instead?


    Code for my AjaxManager:

     

     

     

     

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadSchedulerProScreen" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadSchedulerProScreen">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadSchedulerProScreen" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>

     

    After i added OnAjaxRequest="RadAjaxManager1_AjaxRequest", i get a compilation error saying 'RadAjaxManager1_AjaxRequest' is not a member of 'ASP.schedule_aspx'.
    But it clearly is:

    Private Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest
    TextBox2.Text = e.Argument.ToString()
    End Sub
  4. Jostein
    Jostein avatar
    16 posts
    Member since:
    Oct 2011

    Posted 11 Jan 2012 Link to this post

    Ok, solved this eventually by using the following code in OnClientAppointmentEditing:

    function cancelEdit(sender, args) {
             args.set_cancel(true);
    }


    Now the edit templates stop showing, and i can run my code. Still having a lot of trouble with this when inside an updatepanel, though...

















  5. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 12 Jan 2012 Link to this post

    Hello Jostein,

    Canceling the OnClientAppointmentEditing event has the same effect as setting the AllowEdit property to false. Therefore, if this property is set to false, there is no need to cancel the aforementioned client event.

    I have tested your scenario, and everything is working fine. The AjaxRequest event handler is fired as it should. I still recommend to use templates or follow Richard's advance for such scenarios.

    As for using RadAjaxManager along with asp:UpdatePanel -- this is not a supported scenario. Both controls make call-back to the server -- therefore they cannot be used together. Having the RadAjaxManager control with the appropriate configuration should cover all cases where an AJAX request to the server is needed. You could visit the client-side API help article of the RadAjaxManager, for more information.

    Greetings,
    Ivana
    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
  6. Jostein
    Jostein avatar
    16 posts
    Member since:
    Oct 2011

    Posted 13 Jan 2012 Link to this post

    Hi.

    Thanks for your answer. However, I am not sure you are right. My scheduler has always had AllowEdit=False. Still both the inline and template editor shows on a doubleclick on an appointment, depending on whether advanced edit is on or not. After i added the set_cancel code, they stopped showing.

    When it comes to the updatepanel, the reason for using it is to get a partial page update, and i can not do without it. So if it had not worked with these controls, i would have had to to find others.Luckily, after i moved the RadAjaxManager INSIDE the updatepanel, everything works just fine. So saying they "cannot be used together" is a bit of an overstatement... :)

    The reason my AjaxRequest event handler did not fire, had to do with my AjaxManager settings and is fixed. So all in all, i got this one figured out.
  7. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 17 Jan 2012 Link to this post

    Hi,

    When AllowEdit property of RadScheduler is set to false, no AdvancedForm or InlineForm should be opened. The same goes for dragging, dropping and resizing of appointments -- all these operations are disabled because appointment's editing of any kind is not allowed.
    Could you specify the version of RadControls that you are using?

    As for the RadAjaxManager, if the AJAX is enabled and it is set to update a control on the page -- using it when there is asp:UpdatePanel on the page, is not supported. You can find more information of RadAjaxManager at our online documentation: ( http://www.telerik.com/help/aspnet-ajax/ajax-ajaxmanager.html ).

    I hope this is helpful.

    Greetings,
    Ivana
    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
Back to Top