Does anyone know how can I set the asp:HyperLink href to "mailto:[email protected]" in .net c#?
Example: If I have the following code:
<tr>
<td class="graytext r">PERSONAL EMAIL:</td>
<td><asp:HyperLink runat="server" ID="sPersonalEmail" class="orange" style="cursor:pointer" /></td>
</tr>
How can I set the href to "mailto:[email protected]" in .net c# instead of hard code it in asp:HyperLink?
Something like this by setting NavigateUrl
:
<asp:HyperLink runat="server" NavigateUrl='<%# Bind("Email", "mailto:{0}") %>'
Text='<%# Bind("Email") %>'
ID="hlEmail">
</asp:HyperLink>
I find this the easiest
string whateverEmail = "[email protected]";
hypEmail.Attributes.Add("href", "mailto:" + whateverEmail );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With