B/S在线出库系统,类似购物车,点击“加入申请列表”按钮后只能显示一条申请记录,我的代码哪里有问题?
B/S在线出库系统,类似购物车,点击“加入申请列表”按钮后只能显示一条申请记录,我的代码哪里有问题?我在一个页面用的两个PANEL,在线等!
private void btnTemp_Click(object sender, System.EventArgs e)
{
string sql;
//string str_Sqr = (string)Session["UserName"];
//string sqr=Convert.Tostring(Session["UserName"]);
for(int i = 0;i < dg_kcbgyp.Items.Count; i++)
{
Label ID=(Label)dg_kcbgyp.Items[i].FindControl("ID");
TextBox txtSL = (TextBox)dg_kcbgyp.Items[i].FindControl("txtSL");
string str_ID=ID.Text;
string str_Tmp = txtSL.Text;
int str_Tmp1 = new int();
str_Tmp1=int.Parse(str_Tmp);
if (str_Tmp1 != 0)
{
sql="Select * from kcbgyp where id='"+str_ID+"'";
Panel2.Visible=true;
Panel1.Visible=false;
string strCon = System.Configuration.ConfigurationSettings.AppSettings["DSN"];
SqlConnection con = new SqlConnection(strCon);
SqlDataAdapter da = new SqlDataAdapter(sql,con);
DataSet ds = new DataSet();
da.Fill(ds,"0");
Dg_Cart.DataSource = ds.Tables["0"].DefaultView;
}
}
Dg_Cart.DataBind();
}