⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 park.aspx.cs

📁 物业管理系统
💻 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_fix : System.Web.UI.Page
{
    stringoperator strOper = new stringoperator();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Convert.ToString(Session["UID"]) == "")
            {
                Response.Redirect("login.aspx");

            }
            else
            {
                this.bind();

            }

        }
        this.bind();
    }

    public void bind()
    {
        BaseClass bc = new BaseClass();

        string strsql = "SELECT * from basepark";



        bc.ExecGridView(GridView1, strsql);//绑定数据
    }

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (e.Row.Cells[2].Text.ToString().Length >20)
            {
                e.Row.Cells[2].Text = strOper.SubStr(e.Row.Cells[2].Text.ToString(), 20);//如果一串字符大于一定长度就载取部份显示

            }

       
            ((LinkButton)(e.Row.Cells[4].Controls[0])).Attributes.Add("onclick", "return confirm('将删除停车场所有的停车位,确定删除吗,?')");
            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#99ccff';this.Style.color='buttontext';this.Style.cursor='default';");
            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='';this.style.color='';");
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        this.GridView1.PageIndex = e.NewPageIndex;
        this.bind();
    }




    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 basepark where parkID='" + id + "'";
        if (bcc.ExecSql(sqlstr))
        {
            Response.Write("<script>alert('删除信息成功!');</script>");
            this.bind();
        }
        else
        {
            Response.Write("<script>alert('操作失败:检查是否存在住户停车位!');</script>");
        }
    }

    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        string id = this.GridView1.DataKeys[e.NewEditIndex].Value.ToString();
        Response.Write("<script>window.open('editpark.aspx?parkID=" + id + "','','width=450,height=500')</script>");
        Response.Write("<script>location='javascript:history.go(-1)'</script>");

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -