selectcw.aspx.cs

来自「是个小区车辆管理系统」· CS 代码 · 共 35 行

CS
35
字号
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_SelectCw : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            // 显示车位管理信息
            this.GridView1.DataSource = DataControl.GetData("select * from 车位管理 where 车位类别='固定车位' and 车位代码 not in (select 车位代码 from  分配车位)");
            this.GridView1.DataBind();
        }

    }

    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string idKey = this.GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)]["车位代码"].ToString();
        if (e.CommandName == "Sel")
        {
            //将选择的车位代码返回到调用它页面的指定控件中
            Response.Write("<script>window.opener.document.getElementById('Hidden1').value ='" + idKey + "';window.opener.document.getElementById('Textbox1').value ='" + this.GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text.ToString() + "';window.close();</script>");
        }
    }
}

⌨️ 快捷键说明

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