show extra number of appointments on day

8 posts, 0 answers
  1. Raju
    Raju avatar
    16 posts
    Member since:
    Dec 2012

    Posted 31 Jan 2013 Link to this post

    Hi,

    I have schedular on my page. i set MonthView-VisibleAppointmentsPerDay=4 for my schedular.
    i want to display the showmore message as the count of extra appointments on that day.


    Please help...


    Thanks 
    Raju
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 31 Jan 2013 Link to this post

    Hi Raju

    The MonthView-VisibleAppointmentsPerDay property itself determines the number of appointments a cell in Month view can display and then if the number of appointments for a day exceeds this limit, the cell displays a link labeled "more..."
    Then set MonthView-AdaptiveRowHeight to "true" to allow independent row height.

    Thanks
    Princy
  3. Raju
    Raju avatar
    16 posts
    Member since:
    Dec 2012

    Posted 31 Jan 2013 Link to this post

    Hi Princy,

    I want to show the custom message like

    if there are 7 appointments in a cell. And i set MonthView-VisibleAppointmentsPerDay=4. Then the message should be "3 more". 

    For this i used the below code.

    protected void radSchedulerAssignments_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
            {
                 
                    if (e.TimeSlot.Appointments.Count > 4)
                    {
                        int temp = e.TimeSlot.Appointments.Count - 4;
      
                        //radTeacherSchedulerAssignments.Localization.ShowMore = "+ " + temp + " more ...";
                          
                        radTeacherSchedulerAssignments.Appointments[Convert.ToInt32(e.TimeSlot.Index)].Owner.Localization.ShowMore = "+ " + temp + " more ...";
                        radTeacherSchedulerAssignments.Appointments[Convert.ToInt32(e.TimeSlot.Index)].Owner.MonthView.VisibleAppointmentsPerDay = 4;
                        UPSchedulerAssigns.Update();
      
                    }
                 
            }


    it is showing as per my requirement. But the problem is same message for all cells which have extra appointments more than 4. It is taking last cell count which is having extra appointments more than 4.


    Example:

    cell 1 having 7 appointments
    cell 3 having 6 appointments
    then it is showing "2 more" message for both cells.


    Thanks 
    Raju
  4. Raju
    Raju avatar
    16 posts
    Member since:
    Dec 2012

    Posted 31 Jan 2013 Link to this post

    Hi Princy, Please address my issue....
  5. Raju
    Raju avatar
    16 posts
    Member since:
    Dec 2012

    Posted 04 Feb 2013 Link to this post

    Hello telerik team...

    Can you please resolve my issue. 

    regards
    Raju
  6. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 04 Feb 2013 Link to this post

    Hi Raju,

     
    Here is one way to achieve such functionality:

    protected void RadScheduler1_TimeSlotCreated(object sender, TimeSlotCreatedEventArgs e)
        {
             
            RadScheduler scheduler = (RadScheduler)sender;
            if (scheduler.SelectedView==SchedulerViewType.MonthView)
            {
                if (e.TimeSlot.Appointments.Count>0)//count of visible appointments
                {
                    int visibleAppointments = RadScheduler1.MonthView.VisibleAppointmentsPerDay;
                    int realCountOfAppointments= scheduler.Appointments.GetAppointmentsInRange(e.TimeSlot.Start, e.TimeSlot.End).Count;//count of all appointments in the timespan
     
                    if (realCountOfAppointments - visibleAppointments>0)
                    {
                        e.TimeSlot.CssClass = (realCountOfAppointments - visibleAppointments) + "moreAppointments";
                    }
                   
                }
            }
    <script type="text/javascript">
     
               function pageLoad() {
                   var $ = $telerik.$;
                   $("[class$='moreAppointments']").each(function(index,elem){
                       $(this).find(".rsShowMore").text($(this).attr("class").substring(0, $(this).attr("class").indexOf("moreAppointments")) + " more");
                      
                   });
     
               }

    Hope this will be helpful.

    All the best,
    Plamen
    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.
  7. Raju
    Raju avatar
    16 posts
    Member since:
    Dec 2012

    Posted 04 Feb 2013 Link to this post

    Hi Plamen,

    I have tried the code given, but not able to achieve the desired functionality.

    Thanks
    Raju K
  8. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 04 Feb 2013 Link to this post

    Hi Raju,

     
    I am attaching my test Web Page where the test of the more button was changed accordingly.

    Hope this will be more helpful.

    Greetings,
    Plamen
    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