Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted

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"; 
  }
 }



Best regards
Espen Harlinn
 
Share this answer
 
v2
Comments
ujjwal uniyal 1-Jan-12 10:03am    
thnks for having look at my question but i don want to use hypelink form desing view insted i want to do something like this

lblMessage.Text = "Account Approved, please Login to continue";

but the problem that i am facing is that i am not able to set ( " ) in the right places so it's giving me error. any solution for this ???

bdw HAPPY NEW YEAR :)
ujjwal uniyal 1-Jan-12 10:04am    
it's showing the link for login here but showing error in code behind .. lol
Do one thing use your desired url in .aspx page, apply styles to block or none.That's simple
 
Share this answer
 
Comments
ujjwal uniyal 2-Jan-12 4:03am    
anyone can do that from design page. i want to do it from code behind besides you can not insert a link in the text of a label from .aspx.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900