📄 myexampredict.ascx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using TeachHelper.BusinessLogicLayer;
public partial class TeachHelper_Controls_MyExamPredict : System.Web.UI.UserControl
{
int departmentId;
int grade;
int majorId;
int classes;
DateTime beginDate;
DateTime endDate;
Student my;
protected void Page_Load(object sender, EventArgs e)
{
//对于没有数字的内容,下面这行完全满足要求,但加了数字就不行,必须调用OnItemDataBound
this.GridViewExamPredict.Attributes.Add("style", "word-break:keep-all;word-wrap:normal");
if (!IsPostBack)
{
InitDate();
BindData();
}
}
protected void ButtonSubmite_Click(object sender, EventArgs e)
{
BindData();
}
private void BindData()
{
if (!Roles.IsUserInRole("学生"))
{
return;
}
my = new Student();
departmentId = my.DepartmentId;
grade = my.Grade;
majorId = my.MajorId;
classes = my.Classes;
beginDate = Convert.ToDateTime(this.TextBoxBeginDate.Text);
endDate = Convert.ToDateTime(this.TextBoxEndDate.Text);
DataSet ds = Exam.GetCollectByDepartmentIdGradeMajorIdClassTime(departmentId, grade, majorId, classes, beginDate, endDate);
if (ds.Tables[0].Rows.Count == 0)
{
this.LabelMessage.Text = "没有您要查询的数据";
this.LabelMessage.Visible = true;
this.GridViewExamPredict.Visible = false;
}
else
{
this.GridViewExamPredict.DataSource = ds;
this.GridViewExamPredict.DataBind();
this.LabelMessage.Visible = false;
this.GridViewExamPredict.Visible = true;
}
}
private void InitDate()
{
this.TextBoxBeginDate.Text = DateTime.Today.ToShortDateString();
this.TextBoxEndDate.Text = DateTime.Today.AddMonths(1).ToShortDateString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -