Forum  Commercial Foru...  Commercial Foru...  Schedule Box - Can the Day of week name go in the header?
Previous Previous
 
Next Next
New Post 6/5/2012 6:47 AM
  sramirez@dynacal.com
508 posts
1st Level Poster


Schedule Box - Can the Day of week name go in the header? 

If I am in week mode, the header shows the date Ex: 5/1/2012.  Is it possible to have it show something like  "Wed 5/1/2012"?

 

Thanks,

Shawn

 
New Post 6/5/2012 1:36 PM
  palli
14324 posts
1st Level Poster




Re: Schedule Box - Can the Day of week name go in the header? 

 Hi Shown,

If I am not mistaken, the ScheduleBox uses the current culture's Date.ToShortDateString() to format the headers, so the following code might give you ideas for an inherited ScheduleBox class (which you must also register in web.config):

 

    public class MyScheduleBox : Gizmox.WebGUI.Forms.ScheduleBox
    {
        private System.Globalization.CultureInfo mobjCustomCulture = null;
        private System.Globalization.CultureInfo mobjSavedCulture = null;
 
        private void SetCustomCulture()
        {
            if (mobjCustomCulture == null)
            {
                mobjCustomCulture = System.Globalization.CultureInfo.CreateSpecificCulture(System.Threading.Thread.CurrentThread.CurrentCulture.Name);
                string[] myDateTimePatterns = new string[] { "ddd MM/dd/yy", "ddd MM/dd/yyyy" };
                mobjCustomCulture.DateTimeFormat.SetAllDateTimePatterns(myDateTimePatterns, 'd');
            }
            mobjSavedCulture = System.Threading.Thread.CurrentThread.CurrentCulture;
            System.Threading.Thread.CurrentThread.CurrentCulture = mobjCustomCulture;
        }
 
        private void RestoreCulture()
        {
            System.Threading.Thread.CurrentThread.CurrentCulture = mobjSavedCulture;
        }
        protected override void RenderDayAttributes(Gizmox.WebGUI.Common.Interfaces.IResponseWriter objWriter, DateTime objDay)
        {
            SetCustomCulture();
            base.RenderDayAttributes(objWriter, objDay);
            RestoreCulture();
        }
    }

 

Hope this helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  Schedule Box - Can the Day of week name go in the header?
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS