日期:2014-05-17 浏览次数:20563 次
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
public partial class newadmin_kucun_Default : System.Web.UI.Page
{
string _conn = WebConfigurationManager.ConnectionStrings["proconnectionstring"].ConnectionString;
public List<int> dingdan = new List<int>();
public int jishu;
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
jishu = 0;
Label1.Text = "这是页面firstload";
}
Label1.Text = "这是页面reload";
jishu = jishu + 1;
}
protected void caozuo(object sender, CommandEventArgs e)
{
if (e.CommandName == "show")
{
dingdan.Add(int.Parse(e.CommandArgument.ToString()));
Label1.Text = Label1.Text + jishu.ToString();
ListBox1.DataSource = dingdan;
ListBox1.DataBind();
// 为什么每次listbox 只显示一条id记录呢
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="newadmin_kucun_Default" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">