📄 editsquad.aspx.cs
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -