
那得看你是用的什么方式传递的参数,我只能是把所有的传参和获取方法列出来,具体是那个你自己看把。
在之前假设第一个页面为sendaspx,第二个页面为receiveaspx
1、通过URL链接地址传递
(1) sendasp代码
protected void Button1_Click(object sender, EventArgs e)
{
RequestRedirect("Default2aspxusername=honge");
}
(2) receiveaspx代码
string username = RequestQueryString["username"];//这样可以得到参数值。
2、POST方式传递
(1) sendasp代码
<form id="form1" runat="server" action="receiveaspx" method=post>
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
<asp:TextBox ID="username" runat="server"></asp:TextBox>
</div>
</form>
(2) receiveaspx代码
string username = RuquestForm["receive"];
3、Session方式传递
(1) sendasp代码
protected void Button1_Click(object sender, EventArgs e)
{
Session["username"] = "honge";
RequestRedirect("Default2aspx");
}
(2) receiveaspx代码
string username = Session["username"];//这样可以得到参数值。
4、Application方式传递
(1) sendasp代码
protected void Button1_Click(object sender, EventArgs e)
{
Application["username"] = "honge";
RequestRedirect("Default2aspx");
}
(2) receiveaspx代码
string username = Application["username"];这样可以得到参数值。
5、使用ServerTransfer进行传递
(1) sendasp代码
public string Name
{
get {
return "honge";
}
}
protected void Button1_Click(object sender, EventArgs e)
{
ServerTransfer("Default2aspx");
}
(2) receiveaspx代码
send d = ContextHandler as send ;
if (d != null)
{
ResponseWrite(dName);//这样可以得到参数值。
}
<table><tr><td id="txt">其实我是性把获取到的参数放在这里。</td></tr></table>var txt = documentgetElementById("txt");
txtinnerHTML = rt;
ajs
// 页面跳转,URL地址是将要跳转的页面相对当前页面的路径 wxnavigateTo({
url: '//help/helpdata=' + {num:'33'},
})
help页面
onLoad: function (options) { // 打印页面传递来的参数
consolelog('options',options) // 打印页面传递来的参数类型
consolelog(typeof(optionsdata))
},
不能用<a ></a>只能用按钮+javascript实现
或者
<form action="2asp" method="post">
<select name="a1">
<option selected value="">请选择</option>
<%
sql="select distinct kind1 from test"
set rs=servercreateobject("adodbrecordset")
rsopen sql,conn,1,1
While Not rsEOF
%>
<option value=<%=rs("kind1")%>>
<%=rs("kind1")%></option>
<%rsMoveNext
Wend
rsclose
set rs=nothing
%>
</select><input type="submit" name="Submit" value="本级目录显示"></form>
以上就是关于asp.net页面如何获取传递给自己的参数全部的内容,包括:asp.net页面如何获取传递给自己的参数、html静态页面传参数,我获取到了参数,怎么打使用起来、小程序怎么在页面获取接口里面的传参data数据等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)