Friday, December 26, 2008

Download Month Calendar User Control!

We get many advance Calendar controls on the internet and in controls library, but I was struggling to find the Month Calendar control. A control that will only display months in a year with a hyperlink(event). Finally here is one that I have developed.

Usage:

Code in ASPX Page:

<%@ Register Src="~/UserControls/MonthSelectControl.ascx" TagName="MonthSelectControl" TagPrefix="uc1" %>

<div>

<uc1:MonthSelectControl ID="TestControl" runat="server" />

</div>

Code in .aspx.cs (CodeBehind) Class:

In Page_Load event register the Month Calendar control DateChanged event as shown below:

TestControl.DateChanged += new EventHandler(Control_DateChanged);

Code for the DateChanged Event:

void DateChanged(object sender, EventArgs e)

{

MonthCalendar.
MonthCalendarControlEventArgs arg = (MonthCalendar.MonthCalendarControlEventArgs) e;

string month = arg.Month;

string year = arg.Year;

}

Download the control here.

Your comments are welcome :)

4 comments:

Unknown said...

Dear Sandeep could you please explain what does string month means and how many days there are in string month i came across to this terminology in oil and gas sector

Unknown said...

Dear Sandeep could you please explain what does string month means and what are the number of days in that string month, i came across to this terminology in oil and gas sector...however i'm not able to understand how it differs from normal month?

Sandeep Aparajit said...

Dear Indira, String is the data type for the month variable declared in the above code. There is no specific meaning to term "string month" and it is not at all related to oil and gas sector :)

Anonymous said...

Thanks Sandeep. I have also found this today though might be interesting to you... String-month - Measure of rig activity: one rig operating for one year equals 12 string-months.

Post a Comment