家教信息管理系统毕业论文设计(ASP.NET)(5)
资料介绍:
}
#endregionpublic partial class serach : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(TeacherManager .a ==1)
{
string txt = TeacherManager.b;
RepSerach.DataSource = new TeacherManager().SelectCourseTeacher(txt);
RepSerach.DataBind();
}
else
if(TeacherManager .a ==2)
{ [来源:http://Doc163.com]
string txt = TeacherManager.b;
RepSerach.DataSource = new TeacherManager().SelectAddressTeacher(txt);
RepSerach.DataBind();
}
else
if (TeacherManager .a ==3)
{
string txt = TeacherManager.b;
RepSerach.DataSource = new TeacherManager().SelectPriceTeacher(txt);
[资料来源:http://Doc163.com]
RepSerach.DataBind();
}
}
}
5.2.4论坛功能模块的代码
public partial class PostList : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{ // 第一次进入该页面时,绑定所有帖子
rePost.DataSource = PostManager.SelectAllPost();
rePost.DataBind();
}
}
protected void btnBiuPost_Click(object sender, EventArgs e) [资料来源:https://www.doc163.com]
{
//验证验证码
string code = txtCode.Text.Trim().ToUpper();
string rightCode = Session["Code"].ToString();
if (code != rightCode)
{
//弹出验证码输入错误后,页面不会出现空白
Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('验证码输入错误!');</script>");
return;
}
//添加进数据库
string postTitle = txtPoTitle.Text; [资料来源:http://Doc163.com]
Model.Post P = new Model.Post(postTitle);
bool b = PostManager.InsertPost(P);
if (b)
{
//清空文本框
txtPoTitle.Text = "";
txtCode.Text = "";
//重新绑定所有帖子
rePost.DataSource = PostManager.SelectAllPost();
rePost.DataBind();