I want to make an email link using databinding. I am able to get and display
the email address from the database it is stored in using databinding as
follows:
<asp:HyperLink id="lnkEmail1" runat="server" NavigateUrl='<%#
DataBinder.Eval(Container, "DataItem.email") %>' Target="_blank"><%#
DataBinder.Eval(Container, "DataItem.email") %></asp:HyperLink>
However, you will notice that because the NavigateUrl attribute is the same
as the displayed text (I did not add the MAILTO:) the browser interprets it
as a URL. When I try to add the MAILTO: I recieve a runtime error. How do I
fix this so that the NavigateUrl attribute starts with MAILTO: like I want
it to? Thanks.

Signature
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
Ken Tucker [MVP] - 11 Jul 2005 08:15 GMT
Hi,
Take a look at this version of databinder.eval. Untested
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlr
fsystemwebuidatabinderclassevaltopic2.asp
<asp:HyperLink id="lnkEmail1" runat="server" NavigateUrl='<%#
DataBinder.Eval(Container, "DataItem.email", "MailTo:{0}") %>'
Target="_blank"><%# DataBinder.Eval(Container, "DataItem.email")
%></asp:HyperLink>
Ken
---------------------------
I want to make an email link using databinding. I am able to get and display
the email address from the database it is stored in using databinding as
follows:
<asp:HyperLink id="lnkEmail1" runat="server" NavigateUrl='<%#
DataBinder.Eval(Container, "DataItem.email") %>' Target="_blank"><%#
DataBinder.Eval(Container, "DataItem.email") %></asp:HyperLink>
However, you will notice that because the NavigateUrl attribute is the same
as the displayed text (I did not add the MAILTO:) the browser interprets it
as a URL. When I try to add the MAILTO: I recieve a runtime error. How do I
fix this so that the NavigateUrl attribute starts with MAILTO: like I want
it to? Thanks.

Signature
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/