Solved

Change asp.net calendar control Title programatically

Posted on 2014-11-19
2
157 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 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