?? cargo_list1.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 Cargo_list1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection strcon = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["strcon"]);
strcon.Open();
SqlDataAdapter sda = new SqlDataAdapter("select * from tb_Cargo order by id desc",strcon);
DataSet ds = new DataSet();
sda.Fill(ds, "tb_Cargo");
this.GridView1.DataSource = ds.Tables["tb_Cargo"];
this.GridView1.DataKeyNames = new string[] { "id" };
this.GridView1.DataBind();
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}
protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
string id = this.GridView1.DataKeys[e.NewSelectedIndex].Value.ToString();
Response.Write(id);
if (Session["bus"] == null)
{
System.Collections.Hashtable ht = new Hashtable();
ht.Add(id, 1);
Session["bus"] = ht;
// Session.Add("bus",ht);
}
else
{
System.Collections.Hashtable ht = (Hashtable)Session["bus"];
if (ht[id] == null)
{
ht[id] = 1;
}
else
{
ht[id] = (int)ht[id] + 1;
}
Session["bus"] = ht;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(Request["Checkbox1"]);
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
this.DataList1.DataSource =(Hashtable)Session["bus"];
this.DataList1.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
}
protected void Button3_Click(object sender, EventArgs e)
{
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -