Solved

Change asp.net calendar control Title programatically

Posted on 2014-11-19
2
162 Views
Last Modified: 2014-11-20
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!
0
Comment
Question by:Scarlett72
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Manoj Patil earned 500 total points
ID: 40454467
Try this on Calender Init method

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

Open in new window

0
 

Author Closing Comment

by:Scarlett72
ID: 40456005
thank you!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question