$求助$ 如何传值?
1.aspx 有一串 <a> 标签
<a id = "a1 " href= "2.aspx "> <%=aaaa%> </a>
<a id = "a2 " href= "2.aspx "> <%=bbbb%> </a>
<a id = "a3 " href= "2.aspx "> <%=cccc%> </a>
问如何让2.aspx根据不同的连接显示不同的值
例如
若点击 <a id = "a1 " href= "2.aspx "> <%=aaaa%> </a>
则2.aspx根据 <%=aaaa%> 显示字符串 str1 的值
若点击 <a id = "a2 " href= "2.aspx "> <%=bbbb%> </a>
则2.aspx根据 <%=bbbb%> 显示字符串 str2 的值
------解决方案--------------------拼一下url字符串。
url = "a.aspx?s= " + UrlEncode(aaaa)
------解决方案--------------------1.aspx
<a id = "a1 " href= "2.aspx?str= <%=aaaa%> "> <%=aaaa%> </a>
<a id = "a2 " href= "2.aspx?str= <%=bbbb%> "> <%=bbbb%> </a>
<a id = "a3 " href= "2.aspx?str= <%=cccc%> "> <%=cccc%> </a>
2.aspx
string str = Request.QueryString[ "str "];
Label1.Text = str;
------解决方案--------------------更正
<a id = "a1 " href= "2.aspx?value1= <%=aaaa%> "> 1111 </a>
<a id = "a2 " href= "2.aspx?value1= <%=bbbb%> "> 2222 </a>
在2.aspx里
string value1 = request.querystring( "value1 ");
if(value1==变量aaaa的值){
//就显示str1
}else if(value1==变量bbbb的值){
//就显示str2
}
------解决方案--------------------一般只能如此的。