menu
more_vert
Asp.net--两个页面传参--QueryString

作者:dayu

参数值页面:

  protected void btsmupdate_Click(object sender, EventArgs e)
    {
DB db
= new DB(); string str = "select sid,sname,sex,age,province,education,graduation from staffInfo where sid=‘" + strsid + ""; SqlDataReader dr = db.reDr(str); dr.Read(); if (dr.HasRows) { string strsname = dr.GetValue(1).ToString().Trim(); string strsex = dr.GetValue(2).ToString().Trim(); string strage = dr.GetValue(3).ToString().Trim(); string strprovince = dr.GetValue(4).ToString().Trim(); string streducation = dr.GetValue(5).ToString().Trim(); string strgraduation = dr.GetValue(6).ToString().Trim(); Response.Redirect("~/StaffAdd.aspx?sid=" + strsid + "&sname=" + strsname + "&sex=" + strsex + "&age=" + strage + "&province=" + strprovince + "&education=" + streducation + "&graduation=" + strgraduation + ""); } }

获取页面:

                tbsmid.Text = Request.QueryString["sid"].Trim();
                tbsmname.Text = Request.QueryString["sname"].Trim();
                ddlsmsex.SelectedValue = Request.QueryString["sex"].Trim();
                tbsmage.Text = Request.QueryString["age"].Trim();
                ddlsmprovince.SelectedValue = Request.QueryString["province"].Trim();
                ddlsmeducation.SelectedValue = Request.QueryString["education"].Trim();
                tbsmgraduation.Text = Request.QueryString["graduation"].Trim();

Asp.net--两个页面传参--QueryString

原文地址:http://www.cnblogs.com/Deerjiadelu/p/7252953.html