65.9K
CodeProject is changing. Read more.
Home

Anthem.PersianCalendar - .NET Persian Calendar WebControl

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.65/5 (17 votes)

Mar 5, 2008

CPOL

1 min read

viewsIcon

77637

downloadIcon

4569

An Ajax PersianCalendar Control that looks like Original Calendar of .NET Framework

Anthem2005PlusPersianCalendar

PersianCalendarLogo.jpg

Introduction

As you know, unfortunately there is no suitable Persian Calendar Control that can implement AJAX functionality. So I decided to solve the problem in the easiest way.
Thanks to Anthem Open Source AJAX toolkit, I used it to develop my new Calendar.

Background

A .NET Calendar WebControl in fact is a Table Server Control. In each cell, there is a linkbutton control. So we can make our new Calendar with this Server Control. It’s easy to use and can fill some of our basic needs. One of these basic needs is Style. In a calendar, Styles of different parts are very important (e.g. the Style of Selected Date or Today or NextPrevMonthName and…).

Update

In the new version of Persian Calendar, we have two events:

  • SelectedDayChange
  • SelectedMonthChange

You can handle these events to do any action on date change or month change.

Using the Code

It’s very easy to use. It looks just like original Calendar. It has some extra properties like FarsiDateType that formats the output string in the SelectedFarsiDate property. This property returns the Farsi date of SelectedDate Property.

protected void Button1_Click(object sender, EventArgs e)
{
this.ShowSelectedFarsiDate.Text = string.Format("{0}<p dir=rtl align=left>{1}</p>", 
	this.PersianCalendar1.SelectedDate.ToLongDateString(), 
	this.PersianCalendar1.SelectedFarsiDate);
this.ShowSelectedFarsiDate.UpdateAfterCallBack = true;
}

Points of Interest

During the development of this control, I was interested in Designer Attribute. I created a class that can handle AutoFormat Design-Time Service in this control. I hope this control can fit your needs too.

History

  • Version: 1.5.2 Of Anthem Ajax controls [With Events]
  • Version: 1.5.2 Of Anthem Ajax controls