Reputation: 127
I want to display message within the label by code behind.My code do look like as below.
lblmsg.Text = "Success: You have added " + pujaname + " <a href="ShoppingCart.aspx"> to your shopping cart </a> ";
Here "pujanme" is extracting from database which is coming correctly and secondly I want to inlcude "shopping cart" text which is hyperlink to other page but I am geting error.I will be pleased if somebody guides me. Thankyou
Upvotes: 3
Views: 7668
Reputation: 155
If its vb then you can just write it simple like below: Html can be put inline as long as they are in between double quotes:
lblmsg.Text = "Success: You have added " + pujaname + " your shopping cart
"
Upvotes: 0
Reputation: 3950
You just have to precede the inner "
of url with \
.
lblmsg.Text = "Success: You have added " + pujaname + " <a href=\"ShoppingCart.aspx\"> to your shopping cart </a> ";
Upvotes: 1
Reputation: 666
You can try this. It is working for me.
lblmsg.Text = "Success: You have added " + pujaname +" <a href=\"ShoppingCart.aspx\"> to your shopping cart </a> ";
Upvotes: 5
Reputation: 96571
You have to escape the double quotes in your link (by adding a backslash in front of them):
lblmsg.Text = "Success: You have added " + pujaname +
+ " <a href=\"ShoppingCart.aspx\"> to your shopping cart </a> ";
Upvotes: 1