开发者

mailto and literal control together

Is it possible to do this and how?

email: <a href="" mailto:""email1""">
         <asp:Literal ID="email1" runat="server" 开发者_开发百科>
         </asp:Literal>
       </a> <br />

I try this but when I open outlook it doesn't write anything in TO: section.


If your application is running under .net 3.5;

email:<a href="mailto:<%= Server.HtmlEncode(email1.Text) %>"><asp:Literal Text="info@example.com" ID="Literal1" runat="server"/></a><br/>

If your application is running under .net 4;

email:<a href="mailto:<%: email1.Text%>"><asp:Literal ID="email1" Text="info@example.com" runat="server"/></a><br/>

NOTE:
although you can use the first approach on .net 4 as well, it's better to use the second one in order to avoid so called syntactic noise

hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜