editsquad.aspx.cs
来自「ASP.NET2.0(C#篇)经典教程的源码...本源码很好的实现了购物车...」· CS 代码 · 共 60 行
CS
60 行
using System.IO;
using System;
using System.Web;
using System.Web.UI.WebControls;
partial class EditSquad : System.Web.UI.Page
{
protected void FileUploaded(object sender, PictureUpload.FileUploadEventArgs e)
{
TextBox boundControl = (TextBox)DetailsView1.FindControl("TextBox1");
boundControl.Text = e.FileName;
}
protected void DetailsDataSource_Updated(object sender, System.Web.UI.WebControls.SqlDataSourceStatusEventArgs e)
{
GridView1.DataBind();
}
protected void DetailsDataSource_Inserted(object sender, System.Web.UI.WebControls.SqlDataSourceStatusEventArgs e)
{
GridView1.DataBind();
}
protected void DetailsDataSource_Deleting( object sender, System.Web.UI.WebControls.SqlDataSourceCommandEventArgs e)
{
DateTime today = DateTime.Now;
int startYear;
int endYear;
DateTime seasonStart;
DateTime seasonEnd;
if ( today.Month > 5 )
{
// if the current date is after may then the
// season runs from August until next May
startYear = today.Year;
endYear = today.Year + 1;
}
else
{
// if the current date is before May then the
// season runs from last August to this may
startYear = today.Year - 1;
endYear = today.Year;
}
seasonStart = new DateTime(startYear, 8, 20); // 20th August
seasonEnd = new DateTime(endYear, 5, 31); // 31 May
if ( today >= seasonStart && today <= seasonEnd )
{
e.Cancel = true;
Status.Text = "Cannot delete players during the season";
}
else
{
Status.Text = "";
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?