Asp.net--两个页面传参--QueryString
Posted Deer家的鹿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Asp.net--两个页面传参--QueryString相关的知识,希望对你有一定的参考价值。
参数值页面:
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的主要内容,如果未能解决你的问题,请参考以下文章
2021-06-20 .NET高级班 58-ASP.NET Core WebApi前后端传参详解
2021-07-04 .NET高级班 91-ASP.NET MVC WebApi前后端传参详解
(VIP-朝夕教育)2021-06-06 .NET高级班 41-ASP.NET Core MVC视图传参的几种方式
ASP.NET MVC中jQuery与angularjs混合应用传参并绑定数据