2012-06-28 28 views
0

我有一個html響應消息,我想添加一個鏈接。是否有可能將鏈接添加到以下幾點:c#如何添加一個鏈接到響應消息

responseMsg.InnerText = "Your postcode is in the network, so please proceed to Step 2."; 

我嘗試以下,但它造成的用戶控件崩潰:

responseMsg.InnerText = "Your postcode is in the network, so please <a href="#">proceed to Step 2</a>."; 
+0

你是什麼意思崩潰? – codingbiz

+1

用單引號替換#周圍的雙引號,並在前面放置@符號。即@「Your post ... ... –

回答

2

嘗試將InnerHtml代替:

responseMsg.InnerHtml = "Your postcode is in the network, so please <a href='#'>proceed to Step 2</a>."; 

使用可以逃避錨標記上的雙引號像<a href=\"#\">...</a>

,或者您可以使用單引號像<a href='#'>...</a>

+0

感謝@Saied Cheers!JV – JV10

0

你可以做到這一點無論哪種方式

逃離報價

responseMsg.InnerText = "Your postcode is in the network, so please <a href=\"#\">proceed to Step 2</a>."; 

OR的href

使用單引號
responseMsg.InnerText = "Your postcode is in the network, so please <a href='#'>proceed to Step 2</a>."; 
+0
+0

responseMsg是什麼控制?有InnerHTML屬性? – codingbiz

0

變化對單引號雙引號

responseMsg.InnerText = "Your postcode is in the network, so please "<a href='http://proceedtosteptwo.aspx' title='this is a test'>proceed to Step 2</a>"; 

我希望這對你的工作。

相關問題