Original source: http://www.codeproject.com/aspnet/popupcalendarcontrol.asp
Realization of the pop-up calendar in ASP.NET: Isaias Formacio-Serna can find many realize Calendar control, but when I use them found some problems with ASP.NET Javascript reason is that these controls do not work together. My control allows you to place a calendar that can pop-up but will not return on the page, you can use it as much as possible in the same form.
Introduction
There are many implementations of this control on the Internet. My control is based on Paul Kilmer's work, but I have made some modifications in the place where it can't work. Most modifications are to replace the HMTL control to ASP.NET control, because this can make me better control of the background encoding of the control, you will see this in your code.
Create control
First, you need to create a new control. In this example, I called CTLCalendar. In this control, you need to add the TextBox (TextBox1) control in a web form toolbox, add the Button (Button1) control in the HTML toolbox, then add a Panel (Pnlcaledar) control in a web form toolbox. Finally, in this panel, add a Calendar (Calendar1) control in a web form toolbox. Please note that I am using the HTML toolbox's Button1 control because I don't need to pass values to the server when the user clicks it.
Your control page looks like this:
Here is the code: CTLCALENDAR.ASCX:
Style = "Position: Absolute"> Bordercolor = "# 999999" Font-name = "verdana" font-size = " 8PT " Height = "180px" forcolor = "black" daynaMeformat = "firstletter" Width = "200px" Backcolor = "White"> Dayheaderstyle> SelectedDaystyle> TitleStyle> ask: Calendar> asp: panel> Implement function Now we will use two functions to implement its function. The first is Page_Load, use it to initialize our control; the second is Calendar1_selectionChanged. Private Void Page_Load (Object Sender, System.EventArgs E) { IF (! page.ispostback) { This.TextBox1.text = system.datetime.now.toshortdateString (); This.Pnlcalendar.attributes.add ("style", "Display: None; Position: absolute"); } Else { String id = page.request.form ["__ evenettarget"]. Substring (0, Page.Request.form ["__ evenettarget"]. Indexof (":")); IF (id! = this.id) { This.Pnlcalendar.attributes.add ("style", "Display: None; Position: absolute"); } Else { This.Pnlcalendar.attributes.add ("style", "position: absolute"); } } Page.RegisterClientScriptblock ("script_panel" this.id,