Server side control over functionality

4 posts, 0 answers
  1. Paul
    Paul avatar
    56 posts
    Member since:
    Nov 2010

    Posted 06 Oct 2011 Link to this post

    Hi. I am about to start using the scheduler. I have a rather complex situation and need to provide a lot of control and functionality from code behind.

    I may have missed some capability but it would be useful (as a suggestion for future consideration) to have a "read only" property for appointments. I realise that there is a property for the scheduler but I have a situation where the user can view not only their appointments but also other users' appointments. I could easily set "read only" in the data source (table.userId == myId) but unless I've missed something don't see any capability that supports this.

    My application is a little complex. I cannot therefore predefine a simple datasource and the code behind will have to create and bind the datasource (which I can easily do). However, that means (again unless I've missed some trick or capability) that the scheduler will not have queries for insert, delete and update. Can anyone provide a link to a simple tutorial/example of how to control these events in code behind.

    In my application delete, insert and update are also complicated by the functionality being dependant on the data itself (ie whether the related appointment is the user's appointment or someone else's). Thus my code behind has to really control the whole process and probably the easiest thing is to display custom templates or user controls for the job. Again any link to simple examples would be appreciated and also just confirmation of how to override or cancel the default scheduler behaviour would be appreciated.

    Thanks

    PS in the documentation about the appointment class I noticed some information about "categories". If anyone can provide a link for further information about how to use them I'd appreciate it.
  2. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 07 Oct 2011 Link to this post

    Hi Paul,

    You can refer to this demo where is shown how you can handle the Update/ Insert/ Delete events in code behind.

    With the following code in the code behind separate appointments can become readonly:
    protected void RadScheduler1_AppointmentDataBound(object sender, SchedulerEventArgs e)
       {
           if (e.Appointment.Subject=="AAAAA")
           {
               e.Appointment.AllowEdit = false;
               e.Appointment.AllowDelete = false;
           }
       }

    Hope this helps.

    Best wishes,
    Plamen Zdravkov
    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
  3. Paul
    Paul avatar
    56 posts
    Member since:
    Nov 2010

    Posted 07 Oct 2011 Link to this post

    Hi Plamen

    Thank you very much for your reply which I am sure will point me in the right direction. However, I suspect that I will have some more questions. I have to dash at the moment and will look at the demo and info in detail later.

    I am interested to see that you say that the Appointment object has .AllowEdit and .AllowDelete properties. I have not seen this documented anywhere and I thought that I had read the Appointment class documentation (but could have missed this items). I will try out AllowEdit and AllowDelete but it would be good to understand the built in functionality. What does the scheduler do if you set Appointment.AllowDelete = false;? Does it open a dialog or give a built in message to the user? Can the developer override this built in message/functionality.... or template it?

    Also I am sure that it will all make sense once I have developed the solution and understand how it all works. However, at the moment it feels like I am just missing a high level explanation of things. What does the scheduler do if it doesn't have a definition in the datasource for update/inset/delete queries (ie the datasource is just a select query/linq/business object). In the demo you refer to it uses OnAppointmentUpdate/Delete/Insert but there are also *ing and *ed events (inserting, inserted...). It would be good to have a high level explanation of how these fit together. Some demos say that its necessary to cancel the user action ( .cancel = true;) whereas the demo you refer to just implements OnAppointmentInsert and doesn't seem to explicitly cancel anything. I'm sure that it will get a bit clearer when I look into things more deeply but at the moment I don't have a clear picture of what I need to do.

  4. Plamen
    Admin
    Plamen avatar
    3079 posts

    Posted 10 Oct 2011 Link to this post

    Hi Paul,

    When the Appointment.AllowDelete is set to false the particular appointment can not be deleted and the image delete image is not visible.

    Usually where the insert event is canceled the main reason is to change the default behaviour or the default advanced form.

    You can also have a look at the documentation sections for more information like in this help topic.

    All the best,
    Plamen Zdravkov
    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