Click here to Skip to main content
13,353,462 members (38,339 online)
Click here to Skip to main content
Add your own
alternative version


42 bookmarked
Posted 28 Jan 2007

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

You may also be interested in...


Comments and Discussions

Questionpersain Calendar Pin
Member 106272361-Mar-14 8:24
memberMember 106272361-Mar-14 8:24 
GeneralMy vote of 5 Pin
Member 94374058-Feb-13 19:41
memberMember 94374058-Feb-13 19:41 
Questionmy vote of 5 Pin
mheidari17-Sep-12 11:09
membermheidari17-Sep-12 11:09 
AnswerRe: my vote of 5 Pin
vahid_mardani26-Sep-12 13:29
membervahid_mardani26-Sep-12 13:29 
GeneralMy vote of 5 Pin
mohammadzarew12-Jul-12 23:03
membermohammadzarew12-Jul-12 23:03 
QuestionVery nice Pin
masoudweb6-Aug-11 22:06
membermasoudweb6-Aug-11 22:06 
AnswerRe: Very nice Pin
vahid_mardani7-Aug-11 0:24
membervahid_mardani7-Aug-11 0:24 
GeneralMy vote of 5 Pin
Member 79056528-May-11 0:00
memberMember 79056528-May-11 0:00 
GeneralUse one calender for multiple textbox Pin
faraX_Xx22-Dec-10 0:31
memberfaraX_Xx22-Dec-10 0:31 
GeneralExcellent Pin
Kamyar21-Oct-10 6:29
memberKamyar21-Oct-10 6:29 
GeneralRe: Excellent Pin
vahid_mardani25-Oct-10 7:19
membervahid_mardani25-Oct-10 7:19 
GeneralMy vote of 5 Pin
Kamyar21-Oct-10 6:26
memberKamyar21-Oct-10 6:26 
GeneralMy vote of 5 Pin
sanam6428-Aug-10 11:45
membersanam6428-Aug-10 11:45 
GeneralRe: My vote of 5 Pin
vahid_mardani25-Oct-10 7:18
membervahid_mardani25-Oct-10 7:18 
Generalthis is brilliant piece of work Pin
kazim bhai18-Nov-08 1:59
memberkazim bhai18-Nov-08 1:59 
Questionhi i have e a little problem with this one Pin
Nika Asgari1-Sep-08 1:18
memberNika Asgari1-Sep-08 1:18 
AnswerRe: hi i have e a little problem with this one Pin
Nika Asgari1-Sep-08 19:23
memberNika Asgari1-Sep-08 19:23 
AnswerRe: hi i have e a little problem with this one Pin
vahid_mardani2-Sep-08 12:10
membervahid_mardani2-Sep-08 12:10 
Generali have a problem Pin
Member 33503224-Jun-08 21:23
memberMember 33503224-Jun-08 21:23 
GeneralSuggestionُ Pin
Abbas Sarraf19-Feb-08 2:21
memberAbbas Sarraf19-Feb-08 2:21 
GeneralThanks Pin
Member 251730211-Feb-08 10:06
memberMember 251730211-Feb-08 10:06 
General[Message Removed] Pin
Mojtaba Vali9-Feb-08 21:41
memberMojtaba Vali9-Feb-08 21:41 
GeneralRe: YearPopup and Month popup Problem Pin
vahid_mardani10-Feb-08 12:17
membervahid_mardani10-Feb-08 12:17 
GeneralConfiguration Error Pin
hassan azizi9-Nov-07 22:52
memberhassan azizi9-Nov-07 22:52 
AnswerRe: Configuration Error Pin
vahid_mardani10-Feb-08 12:23
membervahid_mardani10-Feb-08 12:23 

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

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

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 15 Feb 2007
Article Copyright 2007 by vahid_mardani
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid