日期:2014-05-18 浏览次数:20523 次
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace Pranser { public partial class test1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void TextBox1_TextChanged(object sender, EventArgs e) { for (int i = 0; i < int.Parse(TextBox1.Text); i++) { TextBox tb = new TextBox(); tb.ID = "tb"+i.ToString(); Update1.ContentTemplateContainer.Controls.Add(tb); } } protected void Button1_Click(object sender, EventArgs e) { int xx = 0; string[] aw = new string[int.Parse(TextBox1.Text)]; for (int i = 0; i < int.Parse(TextBox1.Text); i++) { string dd = Request.Form["ctl00$ContentPlaceHolder1$tb" + i.ToString()].ToString(); xx = xx + int.Parse(dd); aw[i] = dd; } Totol.Text = aw[1].ToString(); Server.Transfer("test2.aspx"); } } }
int xx = 0; string temp=""; string[] aw = new string[int.Parse(TextBox1.Text)]; for (int i = 0; i < int.Parse(TextBox1.Text); i++) { string dd = Request.Form["ctl00$ContentPlaceHolder1$tb" + i.ToString()].ToString(); xx = xx + int.Parse(dd); temp+= dd+","; aw[i] = dd; } Totol.Text = aw[1].ToString(); Response.Redict("test2.aspx?temp="+temp.TrimEnd(',')); //test2页面再split(',')还原 //Server.Transfer("test2.aspx");