467,892 Members | 1,886 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,892 developers. It's quick & easy.

Making an email link with DataBinder.Eval

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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
  • viewed: 1801
Share:
1 Reply
Hi,

Take a look at this version of databinder.eval. Untested

http://msdn.microsoft.com/library/de...evaltopic2.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
---------------------------
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
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.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Viktor Popov | last post: by
1 post views Thread by Darren Clark | last post: by
5 posts views Thread by Luis E Valencia | last post: by
1 post views Thread by Viktor Popov | last post: by
8 posts views Thread by David | last post: by
1 post views Thread by Luis Esteban Valencia | last post: by
4 posts views Thread by Miguel Dias Moura | last post: by
1 post views Thread by Nathan Sokalski | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.