Month View: Display the Current Week in the first row

5 posts, 0 answers
  1. Amol
    Amol avatar
    57 posts
    Member since:
    Apr 2008

    Posted 27 Oct 2009 Link to this post

    Hi Telerik Team,

    How to Display Current Week on first Row.

    I have RAD Scheduler which have very less height, its showing first two rows of the Scheduler. My Requirement is to show Current Week on the First Row. How it is possible to do?

    Please help me in this situation.

    Amol Wable


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 28 Oct 2009 Link to this post

    Hi Amol,

    I tried following approach in order to show current week as first row in RadScheduler.

    css:
     
        <style type="text/css"
            .hideMe 
            { 
                displaynone !important; 
            } 
        </style> 

    cs:
     
    protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e) 
        if (RadScheduler1.SelectedView == SchedulerViewType.MonthView) 
        { 
            DateTime dtDate = DateTime.Now; 
            int num = GetNumber(dtDate); // Current day 
     
            DateTime dt = (DateTime)e.TimeSlot.Start.Date; 
            int WeekNum = GetNumber(dt);  
            if (WeekNum < num) 
            { 
                e.TimeSlot.CssClass = "hideMe"
            } 
        }         
    public static int GetNumber(DateTime dtDate) 
        CultureInfo ciGetNumber = CultureInfo.CurrentCulture; 
        int returnNumber = ciGetNumber.Calendar.GetWeekOfYear(dtDate, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Sunday); 
        return returnNumber; 

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Amol
    Amol avatar
    57 posts
    Member since:
    Apr 2008

    Posted 28 Oct 2009 Link to this post

    Hi Shinu,

    You are a Genius :)

    That works terrifically well for me. Thanks for your Great Support.

    Amol




  5. Hiten
    Hiten avatar
    5 posts
    Member since:
    Jan 2009

    Posted 02 Mar 2010 Link to this post

    Hi Shinu,

    I have used same code but not giving me proper result because i have used TimeZoneOffset Property. I need to show Calendar as per TimeZone.

    Here is what i have used:

     protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Session[NextJobPLConstants.SESSION_TIMEZONENAME] != null)
                    {

                        double timeOffSet = Convert.ToDouble(Session[NextJobPLConstants.SESSION_TIMEZONEOFFSET].ToString());
                        TimeSpan span = TimeSpan.FromMinutes(timeOffSet);

                        RadSchedulerCalendar.TimeZoneOffset = span;
                        
                    }

                }

    in the TimeSlot Created Event

     protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
        {
            if (RadSchedulerCalendar.SelectedView == SchedulerViewType.MonthView)
            
            
            {
               

                DateTime dtDate = DateTime.Now;
                int num = GetNumber(dtDate); // Current day
                int WeekNum = 0;
                DateTime dt = (DateTime)e.TimeSlot.Start.Date;
           
                WeekNum = GetNumber(dt);
                if (WeekNum < num || dt.Year < dtDate.Year)
                {
                    e.TimeSlot.CssClass = "hideMe";
                    
                     
                }
            }
        }

    Consider my Scenario

    My user is in Hobart i.e. GMT + 10. Current date at server is 1st March.
    Here it does not display me 1st March in Calendar. Please see screenshot for more information.

    Please help me.

    Thanks,
    Hiten





  6. Hiten
    Hiten avatar
    5 posts
    Member since:
    Jan 2009

    Posted 02 Mar 2010 Link to this post

    Hi Shinu,

    I have used same code but not giving me proper result because i have used TimeZoneOffset Property. I need to show Calendar as per TimeZone.

    Here is what i have used:

     protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (Session[NextJobPLConstants.SESSION_TIMEZONENAME] != null)
                    {

                        double timeOffSet = Convert.ToDouble(Session[NextJobPLConstants.SESSION_TIMEZONEOFFSET].ToString());
                        TimeSpan span = TimeSpan.FromMinutes(timeOffSet);

                        RadSchedulerCalendar.TimeZoneOffset = span;
                        
                    }

                }

    in the TimeSlot Created Event

     protected void RadScheduler1_TimeSlotCreated(object sender, Telerik.Web.UI.TimeSlotCreatedEventArgs e)
        {
            if (RadSchedulerCalendar.SelectedView == SchedulerViewType.MonthView)
            
            
            {
               

                DateTime dtDate = DateTime.Now;
                int num = GetNumber(dtDate); // Current day
                int WeekNum = 0;
                DateTime dt = (DateTime)e.TimeSlot.Start.Date;
           
                WeekNum = GetNumber(dt);
                if (WeekNum < num || dt.Year < dtDate.Year)
                {
                    e.TimeSlot.CssClass = "hideMe";
                    
                     
                }
            }
        }

    Consider my Scenario

    My user is in Hobart i.e. GMT + 10. Current date at server is 1st March.
    Here it does not display me 1st March in Calendar. Please see screenshot for more information.

    Please help me.

    Thanks,
    Hiten



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