Can you remove the times from the appointment details?

12 posts, 1 answers
  1. Craig Gamble
    Craig Gamble avatar
    71 posts
    Member since:
    Aug 2005

    Posted 10 Apr 2009 Link to this post

    is it possible to remove the times?

    i am using the monthview where the appointments (or should i say availibilites) are in days and no time is ever specified. this gives me a 00:00AM - 00:00AM in each of the appointments which looks bad. can it be hidden?

    i am binding using a dataprovider also

    Cheers,
    Craig
  2. Answer
    Jordan
    Admin
    Jordan avatar
    547 posts

    Posted 13 Apr 2009 Link to this post

    Hi Craig Gamble,

    Yes, it is possible. You just have to set the AppointmentTitleFormat property to a format that omits the start and end values ({0} and {1}) like bellow:

    this.radScheduler1.AppointmentTitleFormat = "{2} ({3})";

    Also, would you like this feature more if instead of 0, 1, 2 ... were used start, end, etc. (so that the above format would be something like "{{subject}} ({{location}})")?

    Greetings,
    Jordan
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Craig Gamble
    Craig Gamble avatar
    71 posts
    Member since:
    Aug 2005

    Posted 15 Apr 2009 Link to this post

    thats great thanks.

    yeah if you could make it {subject} {location} etc i think it would make it easier to understand for other programmers who may have to work on the code at a later date.

    Cheers,
    Craig
  5. Matthew Link
    Matthew Link avatar
    13 posts
    Member since:
    Oct 2009

    Posted 30 Jul 2010 Link to this post

    Related to this,  Is it possible to still show the dates, but not include the times?
  6. Dobry Zranchev
    Admin
    Dobry Zranchev avatar
    348 posts

    Posted 03 Aug 2010 Link to this post

    Hello Matthew Link,

    Thank you for writing.

    The way to do it is to subscribe for the AppointmentFormating event of the scheduler and set the AppointmentTitleFormat property of the AppointmentElement that is a parameter of the arguments to {0: MM/dd/yyyy} {1:MM/dd/yyyy} {2} {3} where:
    - {0} is StartDate of the appointment
    - {1} is EndDate
    - {2} is Summary
    - {3} is Location

    For further questions feel free to contact us.

    All the best,
    Dobry Zranchev
    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
  7. Matthew Link
    Matthew Link avatar
    13 posts
    Member since:
    Oct 2009

    Posted 04 Aug 2010 Link to this post

    Thanks!  That's just what I needed.
  8. Thi Han
    Thi Han avatar
    15 posts
    Member since:
    Oct 2011

    Posted 27 Dec 2011 Link to this post

    I want to show the subject in schedular .So how to do that  AppointmentTitleFormat.?
  9. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 30 Dec 2011 Link to this post

    Hi Thi Han,

    Thank you for writing.

    As Dobry explained in his post you have to subscribe to the AppointmentFormating event of the RadScheduler and set the TitleFormat of the appointment element. Also there are four pieces of data that can be included in the displayed string using this title format:
    • {0} - Start date
    • {1} - End date
    • {2} - Subject
    • {3} - Location
    Consider the following AppointmentFormating event handler which leaves only the subject to be displayed in the scheduler:
    private void radScheduler1_AppointmentFormatting(object sender, SchedulerAppointmentEventArgs e)
    {
      e.AppointmentElement.TitleFormat = "{2}";
    }

    I hope this will be useful. If you have further questions we would be glad to assist.
     
    Kind regards,
    Ivan Petrov
    the Telerik teamQ3’11 of RadControls for WinForms is available for download (see what's new). Get it today.
  10. Gaston
    Gaston avatar
    3 posts
    Member since:
    Jan 2014

    Posted 27 Jan 2014 in reply to Ivan Petrov Link to this post

    Do you think it is possible to see other information on the AppointmentTitleFormat property such as description or Resources?
  11. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 29 Jan 2014 Link to this post

    Hello Gaston,

    Thank you for writing back.

    Practically, any text you add as literal to a format string will be displayed as is. Therefore in the AppointmentFormatting event you can add any text to the e.AppointmentElement.FormatString property, including the description of the appointment and its resource name. Here is an example:
    private void radScheduler1_AppointmentFormatting(object sender, SchedulerAppointmentEventArgs e)
    {
        IResource resource = e.AppointmentElement.Scheduler.GetResourceStorage().GetById(e.Appointment.ResourceId);
        e.AppointmentElement.TitleFormat = "{2} " + e.Appointment.Description + resource.Name;           
    }

    You can further customize the text by adding some HTML text formatting to the text.

    I hope this helps. Do not hesitate to write back with further questions.

    Regards,
    Ivan Petrov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  12. Gaston
    Gaston avatar
    3 posts
    Member since:
    Jan 2014

    Posted 29 Jan 2014 in reply to Ivan Petrov Link to this post

    I tried to use your code in my project to test it out... and it did not work, it kept showing me the default view. I am new C# so I am sure I am doing something wrong on my end. Can you explain to me on how to implement the code? 
    Thank you, :D
  13. Ivan Petrov
    Admin
    Ivan Petrov avatar
    701 posts

    Posted 31 Jan 2014 Link to this post

    Hello Craig,

    Thank you for your reply.

    There are couple of things to consider regarding my previous code snippet. First you have to subscribe to the event before you populate your scheduler. If you are not sure whether this is the case you can run your project and move (drag drop) an appointment to another time slot. If the text it displays changes then you have subscribed too late. If it does not change then you have not subscribed at all. The second thing to consider is that there might be appointments without resource. In this case the resource object from my example might be null which would result in a NullReferenceException when resource.Name is called. To solve this you should add a check for null before the 

    If none of these solves the problem I would ask you to send me your project or an example one resembling your project which I can use to diagnose the problem. 

    Looking forward to your reply.

    Regards,
    Ivan Petrov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WinForms is Visual Studio 2017 Ready