Click here to Skip to main content
15,896,557 members
Articles / Web Development / ASP.NET

ASP.NET DatePicker (Persian/Gregorian)

Rate me:
Please Sign up or sign in to vote.
4.73/5 (19 votes)
28 Jul 2014CPOL2 min read 165.2K   8.6K   11  
Just another ASP.NET Persian(Jalali/Shamsi/Solar) / Gregorian Datepicker
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Heidarpour.WebControlUI;

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

        }

        protected void btnSubmitPersian_Click(object sender, EventArgs e)
        {
            Label1.Text = "Text: " + DatePicker1.Text;
            Label2.Text = "Date: " + DatePicker1.Date.ToString();
            Label3.Text = "DatePersian: " + DatePicker1.DatePersian;
            

            var t = DatePicker1.CalendarType;
        }

        protected void btnSubmitGregorian_Click(object sender, EventArgs e)
        {
            Label4.Text = "Text: " + DatePicker2.Text;
            Label5.Text = "Date: " + DatePicker2.Date.ToString();
            Label6.Text = "DatePersian: " + DatePicker2.DatePersian;
        }

        protected void btnSubmitEmpty_Click(object sender, EventArgs e)
        {
            Label7.Text = "Text: " + DatePicker3.Text;
            Label8.Text = "Date: " + DatePicker3.Date.ToString();
            Label9.Text = "DatePersian: " + DatePicker3.DatePersian;
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Software Developer (Senior) Respina Network & Beyond IP Pool Tehran PoPSite
Iran (Islamic Republic of) Iran (Islamic Republic of)
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions