Change asp.net calendar control Title programatically

Hi I am trying to change the text of the Title property of a calendar control, I have the initial property set in the .aspx but the only thing that happens when I take it out is that is defaults to current date.

<asp:Calendar ID="Calendar_1" runat="server" VisibleDate="2014-01-01">

Open in new window


As a simple test I have tried the following line in the load event and the DayRender event but it doesn't change:

 
protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
Calendar_1.VisibleDate.AddYears(10);
            }
}

//OR

 protected void DayRender(object sender, DayRenderEventArgs e)
        {           
            Calendar_1.VisibleDate = DateTime.Now.AddYears(10);
}

Open in new window


Any help would be appreciated!
Scarlett72Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Manoj PatilConnect With a Mentor Sr. Software EngineerCommented:
Try this on Calender Init method

Calendar1.VisibleDate = DateTime.Now.Date.AddYears(10).Date;

Open in new window

0
 
Scarlett72Author Commented:
thank you!
0
All Courses

From novice to tech pro — start learning today.