[Supplement] Implement the pop-up calendar in ASP.NET

xiaoxiao2021-03-06  14

Source code for ctlcalendar.ascx:

<% @ Control Language = "c #" AutoEventWireup = "false" Codebehind = "ctlCalendar.ascx.cs" Inherits = "calendar.ctlCalendar" TargetSchema = "http://schemas.microsoft.com/intellisense/ie5" enableViewState = " True "%>
<

TitleStyle Font-Size = "Small" Font-Bold = "True" BorderStyle = "Solid" BorderColor = "Black" BackColor = "# 999999"> CTLCALENDAR.ASCX.CS source code:

namespace calendar {using System; using System.Data; using System.Drawing; using System.Web; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; ///

/// ctlCalendar of Abstract.

/// public class ctlCalendar: System.Web.UI.UserControl {protected System.Web.UI.WebControls.TextBox TextBox1; protected System.Web.UI.WebControls.Panel pnlCalendar; protected System.Web.UI. HtmlControls.HtmlInputButton Button1; protected System.Web.UI.WebControls.Calendar Calendar1; private void Page_Load (object sender, System.EventArgs e) {// Put user code to initialize the page if (Page.IsPostBack!) {this here .TextBox1.text = system.datetime.now.toshortdateString (); this.pnlcalendar.attributes.add ("style", "display: none; position: absolute");} else {string id = page.request.form [ "__Eventtarget"]. 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, "