📄 chargetype.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 admin_fixrepair : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["UID"]) == "")
{
Response.Redirect("login.aspx");
}
else
{
this.bind();
}
}
public void bind()
{
BaseClass bc = new BaseClass();
string strsql = "SELECT * from chargeFeeType";
this.GridView1.DataSource = bc.ExecDS(strsql);
this.GridView1.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
this.GridView1.PageIndex = e.NewPageIndex;
this.bind();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
string id = this.GridView1.DataKeys[e.NewEditIndex].Value.ToString();
Response.Redirect("editchargetype.aspx?ID=" + id + "");
// Response.Write("<script>window.open('editchargetype.aspx?ID=" + id + "','','width=550,height=600')</script>");
// Response.Write("<script>location='javascript:history.go(-1)'</script>");
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string id = this.GridView1.DataKeys[e.RowIndex].Value.ToString();
//Response.Write(id);
//Response.End();
BaseClass bcc = new BaseClass();
string sqlstr = "delete from chargeFeeType where typeID='" + id + "'";
if (bcc.ExecSql(sqlstr))
{
Response.Write("<script>alert('删除信息成功!');</script>");
this.bind();
}
else
{
Response.Write("<script>alert('操作失败!');</script>");
}
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('确定删除吗?')");
// e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#22dd22';this.Style.color='buttontext';this.Style.cursor='default';");
// e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -