我如何从后面的代码中链接到我网站上的另一个页面? [英] how can i give link to another page in my website from code behind ?

查看:68
本文介绍了我如何从后面的代码中链接到我网站上的另一个页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!

我想在用户进入时向用户显示一条消息,并使用标签中的定位标记向他显示链接以转到另一个页面.

我无法编写在标签内使用锚标签的完美语法.

我想要这样的东西-

欢迎用户,请登录<链接以进入login.aspx之类的页面>继续.

我只需要使用后面的代码即可.我在.aspx页上有一个标签,它将显示该消息.

hi all!!

i want to show user a message when he enters and show him a link to go to another page using anchor tags in a label.

i am not able to write the prefect syntax for using the anchor tag inside a label.

i want something like this-

Welcome user please login <link for the page like login.aspx > to continue.

i need to do it using code behind only. i have a label in my .aspx page which will show the message.

推荐答案

我认为您想看看:
HyperLink [
I think you want to take a look at:
HyperLink[^].

or perhaps:
<asp:Label ID="lblMessage" runat="server" Text="Label"></asp:Label>



然后在您的代码背后:



and then in your codebehind:

protected void Page_Load(object sender, EventArgs e)
 {
  if (!IsPostBack)
  {
   string site = "http://harlinn.com";
   lblMessage.Text = "Account Approved, please <a href=\"" 
     + site + "\">Login</a> to continue"; 
  }
 }




最好的问候
Espen Harlinn




Best regards
Espen Harlinn


做一件事,在.aspx页面中使用所需的url,将样式应用为block或不使用.这很简单
Do one thing use your desired url in .aspx page, apply styles to block or none.That''s simple


这篇关于我如何从后面的代码中链接到我网站上的另一个页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆