The My97datepicker date control is a very useful date control, a very good date control.
To achieve a good page refresh, with the date control can have a better enjoyment, this time the OA calendar function also benefited from this control, the specific effect of the figure is as follows:
Part of the code:
Default page layout a calendar date control
<div>
<asp:calendar id= "Calendar1" runat= "Server" width= "100%" showgridlines= "
True" ondayrender= " Calendar1_dayrender ">
</asp:Calendar>
</div>
Default page CS Code:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Data;
Using System.Text;
Public partial class _default:system.web.ui.page {private DataTable table; protected void Page_Load (object sender, EventArgs e) {} protected void Calendar1_dayrender (object sender, DayR
Endereventargs e) {//Get the date now bound calendarday day = E.day;
Gets the cell of the current date TableCell cell = E.cell;
int currentmonth = DateTime.Now.Month; Cell.
Controls.clear (); Table = Planoperator.selectplanbymonth (day.
Date); if (day.
Date.month >= currentmonth) {StringBuilder builder = new StringBuilder (); Builder. AppendFormat ("<font color= ' Blue ' >
Control edit foreground code:
Control Edit Background CS:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using System.Web.UI;
Using System.Web.UI.WebControls;
Using System.Data; Public partial class EditPlan:System.Web.UI.Page {public DateTime StartDate {get {return (DateTime). viewstate["StartDate"]; } set {this. viewstate["StartDate"] = value; } public DateTime EndDate {get {return (DateTime). viewstate["EndDate"]; } set {this. viewstate["EndDate"] = value; } protected void Page_Load (object sender, EventArgs e) {if (this. Request.QueryString.Count!= 2) {this.
Response.End ();
Return } if (!this. IsPostBack) {String action = this.
request.querystring["Action"]; Switch (action) {case ' New ': this. StartDate = Convert.todatetime (this.
request.querystring["StartDate"]); This. EndDate = new DateTime (DateTime.Now.Year, DateTime.Now.Month, (DateTime.Now.AddMonths (1)-DateTime.Now).
Days);
This.pnlNew.Visible = true;
This.pnlEdit.Visible = false;
Break Case ' Edit ': int planid = Convert.ToInt32 (this.
request.querystring["Planid"]);
DataTable table = Planoperator.selectplanbyid (Planid); This.txtTitle.Text = table. rows[0]["Title"].
ToString (); This.txtContent.Text = table. rows[0]["Plancontent"].
ToString (); This.txtStartDate.Text = table. rows[0]["StartDate"].
ToString (); This.txtEndDate.Text = table. rows[0]["EndDate"].
ToString (); This.hidPlanID.Value = table. rows[0]["Planid"].
ToString ();
This.pnlNew.Visible = false;
This.pnlEdit.Visible = true;
Break
Default:break; }} protected void Btninsertplan_click (object sender, EventArgs e) {int I=planoperator.insertplan (THIS.T
Xttitle.text, This.txtcontent.text,this.txtstartdate.text, This.txtEndDate.Text); if (i = = 1) {this. ResponSe. Write (' <script type= ' text/javascript ' language= ' JavaScript ' >alert (' Add the schedule successfully! '); window.opener.location=window.opener.location+ '? '
+math.random (); window.opener= '; Window.close ();</script> ");
Return } this. Response.Write (' <script type= ' text/javascript ' language= ' JavaScript ' >alert (' Add schedule failed! '); window.opener.location=window.opener.location+ '? '
+math.random (); window.opener= '; Window.close ();</script> ");
Return } protected void Btnupdate_click1 (object sender, EventArgs e) {int i = Planoperator.updateplan (t
His.hidPlanID.Value), This.txtTitle.Text, This.txtContent.Text, This.txtStartDate.Text, This.txtEndDate.Text); if (i = = 1) {this. Response.Write (' <script type= ' text/javascript ' language= ' JavaScript ' >alert (' The update schedule is successful! '); window.opener.location=window.opener.location+ '? '
+math.random (); window.opener= '; Window.close ();</script> ");
Return } this. Response.Write ("<script type=" Text/javascrIPT ' language= ' JavaScript ' >alert (' Update schedule failed! '); window.opener.location=window.opener.location+ '? '
+math.random (); window.opener= '; Window.close ();</script> ");
Return } protected void Btndelete_click (object sender, EventArgs e) {int i = Planoperator.deleteplan (convert.toint32 (th
Is.hidPlanID.Value)); if (i = = 1) {this. Response.Write (' <script type= ' text/javascript ' language= ' JavaScript ' >alert (' Delete schedule succeeded! '); window.opener.location=window.opener.location+ '? '
+math.random (); window.opener= '; Window.close ();</script> ");
Return } this. Response.Write (' <script type= ' text/javascript ' language= ' JavaScript ' >alert (' Delete schedule failed! '); window.opener.location=window.opener.location+ '? '
+math.random (); window.opener= '; Window.close ();</script> ");
Return
}
}
The above is about the My97datepicker date control to achieve the OA date of the full content of the function, I hope you will like.