Click here to Skip to main content
Click here to Skip to main content
Go to top

PersianCalendar WebControl Using With AJAX.NET & AjaxControlToolkit

, 15 Feb 2007
Rate this:
Please Sign up or sign in to vote.
This is a Persian web calendar with full features like ASP.NET 2.0 Calendar Control

Sample Image - PersianCalendarControl.jpg


This is a Persian calendar Web Custom control with full features like ASP.NET 2.0 Calendar.

In the demo project, I have used AJAX.NET and AjaxControlToolkit(

For retrieving & setting the Persian date, use "SelectedDatePersian" Properties.You can also use "SelectedDate" Properties for retrieving the selected date in Christ format.This control supports range date selection. For enabling this feature, you must set "SelectionMode" properties to "DayWeekMonth" or "DayWeek" and for retrieving, selected dates range from "SelectedDates" Properties.

PersianCalendar1.SelectionMode = CalendarSelectionMode.DayWeekMonth;
List<DateTime> selectedDates = 

For formatting the selected Persian date, use "SelectedPersianDateFormat".

PersianCalendar1.SelectedPersianDateFormat == 


PersianCalendar1.SelectedPersianDateFormat == PersianDateStringType.Short;

This example demonstrates how to use the PersianCalendar Control with AJAX UpdatePanel.

<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" 
            Inherits="AJAXEnabledWebApplication1._Default" %>
<%@ Register Assembly="KingOf.Net.Web.UI.WebControls.PersianCalendar" 
    Namespace="KingOf.Net.Web.UI.WebControls" TagPrefix="KingOfDotNet" %>
<%@ Register Assembly="AjaxControlToolkit" 
    Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
  <form id="form1" runat="server">
      Persian Calendar Web Control Compatible With Ajax.Net<br />
      <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True">
    </asp:TextBox><br />
      <asp:ScriptManager ID="ScriptManager1" runat="server" />
          <cc1:PopupControlExtender ID="PopupControlExtender1" 
        runat="server" TargetControlID="TextBox1"
                PopupControlID="Panel1" Position="Bottom">
          <asp:Panel ID="Panel1" runat="server" CssClass="popupControl">
              <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                          <KingOfDotNet:PersianCalendar ID="PersianCalendar1" 
                        runat="server" BackColor="#FFFFCC"
                              BorderColor="#FFCC66" BorderWidth="1px" 
                        DayNameFormat="Shortest" Font-Names="Verdana"
                              Font-Size="8pt" ForeColor="#663399" 
                        Height="200px" OnSelectionChanged=
                              SelectedDate="2000-01-01" ShowGridLines="True" 
                            VisibleDate="2000-01-01" Width="220px"
                              <SelectedDayStyle BackColor="#CCCCFF" 
                                Font-Bold="True" />
                              <TodayDayStyle BackColor="#FFCC66" 
                                ForeColor="White" />
                              <SelectorStyle BackColor="#FFCC66" />
                              <OtherMonthDayStyle ForeColor="#CC9966" />
                              <NextPrevStyle Font-Size="9pt" 
                                ForeColor="#FFFFCC" />
                              <DayHeaderStyle BackColor="#FFCC66" 
                            Font-Bold="True" Height="1px" />
                              <TitleStyle BackColor="#990000" 
                            Font-Bold="True" Font-Size="9pt" 
                            ForeColor="#FFFFCC" />

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;
using KingOf.Net.Web.UI.WebControls;

namespace AJAXEnabledWebApplication1
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

        protected void PersianCalendar1_SelectionChanged
                                (object sender, EventArgs e)


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Iran (Islamic Republic Of) Iran (Islamic Republic Of)
Python, PostgreSQL, Cherrypy, Apache, .Net , C#,, .Net Remoting, Ajax, Controls, MVC, SOA, SOAP, Razor

Comments and Discussions

Questionpersain Calendar PinmemberMember 106272361-Mar-14 7:24 
GeneralMy vote of 5 PinmemberMember 94374058-Feb-13 18:41 
Questionmy vote of 5 Pinmembermheidari17-Sep-12 10:09 
AnswerRe: my vote of 5 Pinmembervahid_mardani26-Sep-12 12:29 
GeneralMy vote of 5 Pinmembermohammadzarew12-Jul-12 22:03 
QuestionVery nice Pinmembermasoudweb6-Aug-11 21:06 
AnswerRe: Very nice Pinmembervahid_mardani6-Aug-11 23:24 
GeneralMy vote of 5 PinmemberMember 79056527-May-11 23:00 
GeneralUse one calender for multiple textbox PinmemberfaraX_Xx21-Dec-10 23:31 
GeneralExcellent PinmemberKamyar21-Oct-10 5:29 
GeneralRe: Excellent Pinmembervahid_mardani25-Oct-10 6:19 
GeneralMy vote of 5 PinmemberKamyar21-Oct-10 5:26 
GeneralMy vote of 5 Pinmembersanam6428-Aug-10 10:45 
GeneralRe: My vote of 5 Pinmembervahid_mardani25-Oct-10 6:18 
Generalthis is brilliant piece of work Pinmemberkazim bhai18-Nov-08 0:59 
Questionhi i have e a little problem with this one PinmemberNika Asgari1-Sep-08 0:18 
AnswerRe: hi i have e a little problem with this one PinmemberNika Asgari1-Sep-08 18:23 
AnswerRe: hi i have e a little problem with this one Pinmembervahid_mardani2-Sep-08 11:10 
Generali have a problem PinmemberMember 33503224-Jun-08 20:23 
GeneralSuggestionُ PinmemberAbbas Sarraf19-Feb-08 1:21 
GeneralThanks PinmemberMember 251730211-Feb-08 9:06 
General[Message Removed] PinmemberMojtaba Vali9-Feb-08 20:41 
GeneralRe: YearPopup and Month popup Problem Pinmembervahid_mardani10-Feb-08 11:17 
GeneralConfiguration Error Pinmemberhassan azizi9-Nov-07 21:52 
AnswerRe: Configuration Error Pinmembervahid_mardani10-Feb-08 11:23 
GeneralBug with firefox and ie6 Pinmemberxollo24-Oct-07 5:08 
GeneralRe: Bug with firefox and ie6 Pinmembervahid_mardani10-Feb-08 11:30 
QuestionCompilation Problem PinmemberEhsanShemirani26-Sep-07 22:05 
Questionis your control client side? Pinmemberznarges8027-Aug-07 22:41 
GeneralRe: is your control client side? Pinmembervahid_mardani10-Feb-08 11:32 
Generalanother year Pinmembermaxpayn21-Aug-07 0:35 
Questionhow change calendar js function Pinmemberpmapc868-Jul-07 23:28 
AnswerRe: how change calendar js function Pinmembervahid_mardani10-Jul-07 13:39 
Generalmy problems Pinmemberfa_20646-Mar-07 21:15 
GeneralGood Job PinmemberAhmad Asgharzadeh1-Mar-07 11:04 
GeneralRe: Good Job Pinmembervahid_mardani1-Mar-07 21:19 
Generalnew feature PinmemberYahyaee20-Feb-07 21:33 
AnswerRe: new feature(already have this feature) Pinmembervahid_mardani20-Feb-07 23:18 
GeneralAbout Persian Calendar PinmemberAfsoon13-Feb-07 21:29 
GeneralRe: About Persian Calendar Pinmembervahid_mardani13-Feb-07 21:58 
GeneralRe: About Persian Calendar PinmemberAfsoon14-Feb-07 20:21 
AnswerRe: Persian Calendar Bug Fixed Pinmembervahid_mardani15-Feb-07 7:28 
GeneralRe: Persian Calendar Bug Fixed Pinmemberarash_cce10-Jul-07 4:26 
GeneralRe: Persian Calendar Bug Fixed Pinmembervahid_mardani10-Jul-07 13:15 
GeneralKingOf.NET Pinmemberamirghz0729-Jan-07 8:50 
GeneralThanks Pinmemberbabakzawari29-Jan-07 0:39 
GeneralRe: Thanks Pinmembervahid_mardani29-Jan-07 0:52 
GeneralRe: Thanks PinmemberMajid Shahabfar29-Jan-07 6:19 
GeneralRe: Thanks Pinmembervahid_mardani29-Jan-07 6:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 15 Feb 2007
Article Copyright 2007 by vahid_mardani
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid