This is a migrated thread and some comments may be shown as answers.

Disable edit while allowing double click?

15 Answers 439 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Will
Top achievements
Rank 1
Will asked on 25 Jul 2008, 07:22 PM
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

15 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 28 Jul 2008, 01:10 PM
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.
0
Will
Top achievements
Rank 1
answered on 28 Jul 2008, 02:03 PM
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

0
Peter
Telerik team
answered on 28 Jul 2008, 02:45 PM
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.
0
Will
Top achievements
Rank 1
answered on 28 Jul 2008, 03:05 PM
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
0
Peter
Telerik team
answered on 28 Jul 2008, 03:36 PM
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.
0
Will
Top achievements
Rank 1
answered on 28 Jul 2008, 06:00 PM
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
0
Peter
Telerik team
answered on 29 Jul 2008, 09:00 AM

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.
0
Sean Overman
Top achievements
Rank 1
answered on 12 Aug 2009, 08:37 PM
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; 

0
Rebecca Campbell
Top achievements
Rank 1
answered on 07 Oct 2009, 09:39 PM
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>
0
Peter
Telerik team
answered on 09 Oct 2009, 03:15 PM
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.
0
Ricard Bertran Vall
Top achievements
Rank 1
answered on 29 Dec 2009, 11:04 AM
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.....
0
bad nick
Top achievements
Rank 1
answered on 17 Mar 2010, 12:56 PM
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> 

0
Veena
Top achievements
Rank 1
answered on 11 Oct 2012, 01:15 PM
Do you have vb.net code for the same scenario?
0
Veena
Top achievements
Rank 1
answered on 11 Oct 2012, 02:41 PM
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

 




0
Neha
Top achievements
Rank 1
answered on 07 Oct 2015, 07:40 AM

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?

Tags
Scheduler
Asked by
Will
Top achievements
Rank 1
Answers by
Peter
Telerik team
Will
Top achievements
Rank 1
Sean Overman
Top achievements
Rank 1
Rebecca Campbell
Top achievements
Rank 1
Ricard Bertran Vall
Top achievements
Rank 1
bad nick
Top achievements
Rank 1
Veena
Top achievements
Rank 1
Neha
Top achievements
Rank 1
Share this question
or