[心得] 恩!
網頁一的資料:
string name = txtUser.Text;
string pass = txtPass.Text;
// 轉址且傳遞URL參數至Ch7-3-1.aspx
Response.Redirect("Ch7-3-1.aspx?User=" + Server.UrlEncode(name) +
"&Pass= " + pass);
網頁二:
protected void Page_Load(object sender, EventArgs e)
{
string Username, Password;
// 取得URL參數值
Username = Server.UrlDecode(Request.QueryString["User"]);
Password = Request.QueryString["Pass"];
// 顯示取得的參數值
lblOutput.Text = "名稱: " + Username + "<br/>";
lblOutput.Text += "密碼: " + Password + "<br/>";
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
double h, w;
TextBox txt;
txt = (TextBox)PreviousPage.FindControl("txtWeight");
w = Convert.ToDouble(txt.Text);
txt = (TextBox)PreviousPage.FindControl("txtHeight");
h = Convert.ToDouble(txt.Text);
lblOutput.Text = "BMI:" + (w / h / h);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 134.208.3.230
※ 編輯: MrChild 來自: 134.208.3.230 (11/03 15:59)