如何使用HTML和LT有条件的重定向; A&GT;标签根据查询字符串值在asp.net? [英] How to conditional Redirect using HTML <a> tag depending on QueryString Value in asp.net?
本文介绍了如何使用HTML和LT有条件的重定向; A&GT;标签根据查询字符串值在asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我重定向到Teammember.aspx页从code后面的JavaScript。
I am redirecting to Teammember.aspx page with javascript from code behind.
teammember.Attributes.Add("onclick", "window.location.href='TeamMemberDetails.aspx?Id=" + Id + "'" + "&isabout=true");
在TeamMemberDetails.aspx页面上未来我有一个锚标记:
When coming on TeamMemberDetails.aspx page i have an anchor tag:
<a style="border: 0px none; float: left;" href="TeamMember.aspx">
<img alt="<--" src="Images/ArrowLeft.png" style="display: inline-block; cursor: pointer;border: 0 none;" />
</a>
现在,根据查询字符串参数即ISABOUT的页面必须重定向。
如果ISABOUT =真,那么它必须使用重定向到Memberlist.aspx页别的other.aspx页面HTML锚标记(有条件的重定向)
Now, Depending on Querystring parameter i.e isabout the page must redirect. if isabout=true then it must redirect to Memberlist.aspx page else other.aspx page using HTML Anchor Tag (Conditional Redirect)
推荐答案
把 =服务器
属性,并找到code后面的锚标记。
put runat="server"
attribute and find anchor tag in code behind.
<a id="lnktoRedirect" runat="server">Redirect</a>
背后code:
if (isabout)
{
lnktoRedirect.HRef = "Memberlist.aspx";
}
else
{
lnktoRedirect.HRef = "other.aspx";
}
这篇关于如何使用HTML和LT有条件的重定向; A&GT;标签根据查询字符串值在asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文