当前位置: 代码迷 >> ASP.NET >> 关于在asp.net中用标签A的属性href传递变量到另一个页面的有关问题
  详细解决方案

关于在asp.net中用标签A的属性href传递变量到另一个页面的有关问题

热度:9754   发布时间:2013-02-25 00:00:00.0
关于在asp.net中用标签A的属性href传递变量到另一个页面的问题
我有一个变量string theme1;现要将其设置成超链接,并将theme1传递到另一个页面去,当我点击theme1时页面跳到PostsInfo.aspx,并把theme1传递到PostsInfo.aspx中,要在.cs文件里实现,要怎么做啊啊啊啊啊啊啊啊啊 
 
就像这样,不过错了,传递失败
string str3 = "<div class='theme1'><a href='PostsInfo.aspx?Theme=<%theme1%>'>"+ theme1+ "</a></div>";,

------解决方案--------------------------------------------------------
还是这个意思??

后台代码:
public partial class _Default : System.Web.UI.Page 
{
public string theme1 = "Hello,World!";
protected void Page_Load(object sender, EventArgs e)
{
Page.DataBind();
}
}
前台代码:
<body>
<a href='<%# "PostsInfo.aspx?theme1="+theme1 %>'><%# theme1 %></a>
</body>
  相关解决方案