Disable edit while allowing double click?

16 posts, 0 answers
  1. Will
    Will avatar
    7 posts
    Member since:
    Jun 2008

    Posted 25 Jul 2008 Link to this post

    I am trying to display a detail view of an appointment on double click, while edit is disabled.  Disabling edit on the appointment seems to be disabling the double click server event.  I would like the edit to be disabled but still have the ajax call to the server double click event so that I can switch to the detail view.  What is the best way to accomplish this?

    Thanks,

    Will
  2. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Jul 2008 Link to this post

    Hi Will,

    Here is one possible solution:
    protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e)  
        {  
            if (e.Container.Mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit)  
            {  
                //Disable the basic and advanced control panels:  
                Panel basicControlPanel = (Panel)e.Container.FindControl("BasicControlsPanel");  
                basicControlPanel.Enabled = false;  
                Panel advancedControlPanel = (Panel)e.Container.FindControl("AdvancedControlsPanel");  
                advancedControlPanel.Enabled = false;  
     
                //Hide the Update button  
                LinkButton updateButton1 = (LinkButton)e.Container.FindControl("_updateButton");  
                updateButton1.Visible = false;  
     
                //Rename the Cancel button  
                LinkButton cancelButton = (LinkButton)e.Container.FindControl("cancel");  
                cancelButton.Text = "Close";  
            }  
        } 

    Let us know if you have any other questions.

    Regards,
    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Will
    Will avatar
    7 posts
    Member since:
    Jun 2008

    Posted 28 Jul 2008 Link to this post

    Peter,

    Thanks for your response.  I am using the advanced edit template for the detail view in a manner similar to the code you posted.  However, the issue I’m trying to overcome is that the user is not able view the advanced edit when appointment.AllowEdit is set to false.  Double clicking does not send the event to the server.  If I understand your solution correctly, it depends on the user being able to view the advanced edit template somehow.   How is this accomplished when edit is disabled on the appointment?

    Thanks,

    Will

  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Jul 2008 Link to this post

    Hello Will,

    Sorry for not being specific enought with the suggested solution. With this approach, you should not set appointment.AllowEdit to false. In the FormCreated event I find the controls in the default advanced form and set properties such as Enabled, Visible and Text. This way I disable the basic and advanced control panels, hide the update button and change the text of the cancel button to "close". Please, let me know if I have to provide more details.



    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Will
    Will avatar
    7 posts
    Member since:
    Jun 2008

    Posted 28 Jul 2008 Link to this post

    I didn’t think setting the enabled, visible, and text properties on the advanced edit form would prevent the move or resize by dragging on the calendar.  The only way that I knew to do this was to set AllowEdit to false.  Will setting the properties that you mentioned disable the move and resize somehow?  I may still be misunderstanding the solution if I am incorrect about this.

    Thanks, and I appreciate your patience,

    Will
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 28 Jul 2008 Link to this post

    Hello Will,

    Setting properties of controls in the default advanced form will in no way affect moving and resizing the appointment. I suggest you try the code which I sent you and see for yourself what it does. :-) 


    Cheers,
    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Will
    Will avatar
    7 posts
    Member since:
    Jun 2008

    Posted 28 Jul 2008 Link to this post

    I pasted the code exactly from your post, and the user can still edit by moving or resizing.  The user should not be able to edit the appointment at all.  You told me that AllowEdit should be set to true, which means that whatever solution I implement needs to disable all edit functionality another way.  Is there any way to disable ALL edit functionality but still show the detail view?

    Thanks,

    Will
  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 29 Jul 2008 Link to this post


    I thought you wanted to preserve the ability to move or resize the appointment. If you want to disable these two operations, please use the following approach:

     <script type="text/javascript">  
        function OnClientAppointmentMovingHandler(sender, eventArgs)  
        {  
            eventArgs.set_cancel(true);  
        }      
        function OnClientAppointmentResizingHandler(sender, eventArgs)  
        {  
            eventArgs.set_cancel(true);  
        }  
        </script> 
        <telerik:RadScheduler ID="RadScheduler1" runat="server" 
            OnClientAppointmentMoving="OnClientAppointmentMovingHandler"   
            OnClientAppointmentResizing="OnClientAppointmentResizingHandler" 


    Cheers,
    Peter
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  10. Sean Overman
    Sean Overman avatar
    31 posts
    Member since:
    Sep 2012

    Posted 12 Aug 2009 Link to this post

    Just thought I would post my experience with this.  I had a requirement to where the appointments were still editable, but not resizable from calender view.   the OnClientAppointmentResizingHandler event worked perfectly, except the resize cursor was still visible.
    Adding in this bit of CSS solved that:

    .rsAptResize { 
      cursor:default !important; 

  11. Rebecca Campbell
    Rebecca Campbell avatar
    8 posts
    Member since:
    Jul 2009

    Posted 07 Oct 2009 Link to this post

    I have a similar question, but from the opposite direction.  I want to disable the edit form and implement my own.  We already have a popup form to edit scheduled events that matches our site style, and I'd rather stick with this than use RadDock or the AdvancedEditTemplate.  However, I do want people to be able to move or resize items on the calendar, so setting AllowEdit="false" is not an option.

    I added the OnClientAppointmentDoubleClick property to my instance of RadScheduler.  This launches my popup, but then the form always posts back, so I see my popup for about three seconds before the page refreshes.  I tried adding eventArgs.set_cancel(true); like in your example, and it worked... sort of.  Sadly, it only worked because it caused a JavaScript error that prevented the page from posting back. 

    Here's my sample code...  If you run it and click on an appointment, you'll get an alert.  When you click OK, the page will post back and display an edit form.  I want to prevent the postback from happening.  From your documentation (http://www.telerik.com/help/aspnet-ajax/schedule_clientsideonclientappointmentdoubleclick.html), I see that eventArgs only has one method, so perhaps this isn't possible?

    <script type="text/javascript">   
      function appointmentDoubleClick(sender, eventArgs)
      {
          var apt = eventArgs.get_appointment();
          alert('id=' + apt.get_id());  //my version pops up a page, but the alert will demo the behavior
          //eventArgs.set_cancel(true); //commented out because it raises an error
      }
    </script>

        <telerik:RadScheduler ID="calendar" runat="server" OnClientAppointmentDoubleClick="appointmentDoubleClick"
            HoursPanelTimeFormat="htt" ValidationGroup="calendar" OnAppointmentDataBound="calendar_AppointmentDataBound">
        </telerik:RadScheduler>
  12. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 09 Oct 2009 Link to this post

    Hello Rebecca,

    This is error is expected since OnClientAppointmentDoubleClick cannot be canceled and therefore it does not have the set_cancel() method for the eventArg. Please, try using OnClientAppointmentEditing instead in the same way you used OnClientAppointmentDoubleClick.


    Regards,
    Peter
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  13. Ricard Bertran Vall
    Ricard Bertran Vall avatar
    18 posts
    Member since:
    Sep 2009

    Posted 29 Dec 2009 Link to this post

    In my case I wanted to allow dobleclicking without showing any edit form and I solved it as follow......

    - To get the event of the click on the server: 
           
            RadScheduler1_AppointmentClick

    - And to basic edit form at all:

        protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e)
            {
                if (e.Container.Mode == Telerik.Web.UI.SchedulerFormMode.Edit)
                {
                    e.Container.Visible = false;
                }
            }

    I hope it helps to someone.....
  14. bad nick
    bad nick avatar
    24 posts
    Member since:
    May 2009

    Posted 17 Mar 2010 Link to this post

    mine is a client-side solution:

        <script type="text/javascript" language="javascript"
     
            function ClientAppointmentDoubleClick(sender, eventArgs) { 
                var apt = eventArgs.get_appointment(); 
                alert("You double-clicked on an appointment with the subject: " + apt.get_subject()); 
            } 
             
            // Prevents opening of the in-built edit form 
            function ClientAppointmentEditing(sender, eventArgs) { 
                eventArgs.set_cancel(true); 
            } 
             
        </script> 

  15. Veena
    Veena avatar
    4 posts
    Member since:
    Oct 2012

    Posted 11 Oct 2012 Link to this post

    Do you have vb.net code for the same scenario?
  16. Veena
    Veena avatar
    4 posts
    Member since:
    Oct 2012

    Posted 11 Oct 2012 Link to this post

    VB.NET code below works but I would want to make it visible when new appointment is clicked on the menitems on right clicking timeslot. How do i do that? I want postback on appointment click but no post back on timeslotmenucontextitemclick?

    Protected

     

    Sub SubRadScheduler1_FormCreated(ByVal sender As Object, ByVal e As SchedulerFormCreatedEventArgs) Handles RadScheduler1.FormCreated

     

     

    If e.Container.Mode = Telerik.Web.UI.SchedulerFormMode.AdvancedEdit Then

     

    e.Container.Visible =

    False

     

     

    End If

     

     

    End Sub

     




  17. Neha
    Neha avatar
    1 posts
    Member since:
    Oct 2015

    Posted 07 Oct 2015 Link to this post

    Hi,

    I have Created My Customized Scheduler, And add the events from A button click outside the Scheduler. On Button click i opened a popup.The event is created. But Wen i want to edit that event in scheduler,its own popup open, not mine.. please give me the suggestion What can i do?

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