I have a repeater control that contains an hyperlink control bound to a field in a datareader. I want the user to be able to click the hyperlink and have it launch an email on their system. This would mean using href=mailto:name@domain.co
m syntax in the hyperlink. The code below correctly displays a clickable hyperlink in the repeater:
<asp:HyperLink ID="MailTo" Runat=server NavigateUrl='mailto:<%# Databinder.Eval(Container.
DataItem, "Email") %>' text='<%# Databinder.Eval(Container,
"DataItem.Email") %>'></asp:HyperLink>
However, when you click the link Microsoft Outlook gives the following error:
Cannot start Microsoft Outlook. The command line argument is not valid. Verify the switch you are using.
This is no doubt due to string that they hyperlink control presents to Outlook:
mailto:<%# Databind.Eval(Container.Da
taItem, "Email) %>
It doesn't look like an email address to me either. So I need to get the expression converted to a proper email address string. How do I do it?
Start Free Trial