📄 sel_holiday_resual.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;
public partial class Sel_Holiday_Resual : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["uname"].ToString() != null)
{
this.btndel.Attributes.Add("onClick", "javascript:return confirm('确定删除吗?');");
if (!IsPostBack)
{
band();
}
}
}
private void band()
{
message sel_p_vacation=new message();
this.holidayview.DataSource = sel_p_vacation.sel_people_vacation(Convert.ToInt32(Session["uname"]));
this.holidayview.DataBind();
}
protected void sendboxview_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.holidayview.PageIndex = e.NewPageIndex;
band();
}
protected void holidayview_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标经过时,行背景色变
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ECF3E1'");
//鼠标移出时,行背景色变
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='#FFFFFF'");
DataRowView dv = (DataRowView)e.Row.DataItem;
if (Convert.ToString(dv["v_status"]) == "不批准")
{
((Label)e.Row.FindControl("lab")).BackColor = System.Drawing.Color.Red;
((Label)e.Row.FindControl("lab")).ForeColor = System.Drawing.Color.White;
}
if (Convert.ToString(dv["v_status"]) == "批准")
{
((Label)e.Row.FindControl("lab")).BackColor = System.Drawing.Color.Green;
((Label)e.Row.FindControl("lab")).ForeColor = System.Drawing.Color.White;
}
}
}
protected void btndel_Click(object sender, EventArgs e)
{
for (int i = 0; i <= this.holidayview.Rows.Count - 1; i++)
{
CheckBox check = (CheckBox)this.holidayview.Rows[i].FindControl("checkdel");
if (check.Checked == true)
{
int v_id = Convert.ToInt32(holidayview.DataKeys[i].Value.ToString());
message del_vacation = new message();
del_vacation.del_vacation(v_id);
}
}
band();
Response.Write("<script>alert('删除成功!')</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -