📄 see.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 System.Data.SqlClient;
public partial class Stockpile_see : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Convert.ToString(Session["username"]) == "")
{
Response.Write("<script language=javascript>alert('请登录');location='../login.aspx'</script>");
}
this.bind();
this.Button2.Attributes.Add("onclick","window.close();");
}
}
public void bind()
{
string cid = Request["cid"];
string strsql = "select * from tb_Reckoning where CommodityId=" + cid ;
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlDataAdapter sda = new SqlDataAdapter(strsql, strcon);
DataSet ds = new DataSet();
sda.Fill(ds, "search");
GridView1.DataSource = ds.Tables["search"];
GridView1.DataKeyNames = new string[] { "id" };
GridView1.DataBind();
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
this.bind();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControlRowType.DataRow)
{
e.Row.Cells[0].Text = (e.Row.DataItemIndex+2).ToString();
e.Row.Cells[3].Text = Convert.ToString(Convert.ToDateTime(e.Row.Cells[3].Text).ToShortDateString());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -