📄 query_delstudent_all.aspx.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 XTeamBBL;
public partial class jiaowu_sys_student_allinfo_set_Query_Delstudent_all : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void bind_student_allinfo()
{
string sql = "select * from student_allinfo";
DataSet ds = student_all.select_student_num(sql);
GVstudent_allinfo.DataSource = ds;
GVstudent_allinfo.DataBind();
}
protected void BtnQuery_Click(object sender, EventArgs e)
{
string sql = "select * from student_allinfo,student_info";
if (TBxstudent_num.Text != "")
{
string student_num =TBxstudent_num.Text.Trim();
sql += " where student_allinfo.student_ID=student_info.student_ID and student_info.student_num='" + student_num+"'";
}
DataSet ds = student_all.select_student_num(sql);
GVstudent_allinfo.DataSource = ds;
GVstudent_allinfo.DataBind();
}
protected void GVstudent_allinfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
{Boolean flag = false;
int student_allID = Convert.ToInt32(GVstudent_allinfo.DataKeys[e.RowIndex].Value.ToString());
student_all sa = new student_all(student_allID);
try
{
flag = student_all.del_student_allinfo(sa);
}
catch (Exception)
{
Response.Write("<script>alert('删除失败,可能存在数据依赖,请先删除其他数据,再执行些操作');</script>");
}
finally
{
if (flag) { Response.Write("<script>alert('删除成功');</script>"); }
else Response.Write("<script>alert('删除失败');</script>");
bind_student_allinfo();
}
}
protected void GVstudent_allinfo_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)(e.Row.Cells[6].Controls[0])).Attributes.Add("onclick", "return confirm('确定要删除吗')");
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#E0E0E0';this.style.cursor='hand'");
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -