473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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
1 1985
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Viktor Popov | last post by:
Hi, I'm trying to do the following: I use a repeater control in ASP.NET/C# because I would like to show the content of one DataSet which is filled from SELECT QUERY. In DataSource I have the...
2
by: Stan | last post by:
I cannot make the link buttons fire ItemCommand from repeater control. Here is the code: <asp:repeater id=rptLetters runat="server"> <itemtemplate> <asp:linkbutton id="lnkLetter"...
1
by: Darren Clark | last post by:
I have a link button that i would like to be used if the value of the text is NOT 0... So the code below will always make a linkbutton.... However if the value of...
5
by: Luis E Valencia | last post by:
I need a link on a datagrid, the link must have fields of the database Like this acciones.aspx?iddireccion=1&idindicador=4 Thanks
1
by: Viktor Popov | last post by:
Hi, I'm trying to do the following: I use a repeater control in ASP.NET/C# because I would like to show the content of one DataSet which is filled from SELECT QUERY. In DataSource I have the...
8
by: David | last post by:
This is something I had never seen before. On an aspx page, upon pressing a link button for which I have an event handler in the code behind, the screen shows nothing but a line that says "true"...
1
by: Luis Esteban Valencia | last post by:
I have a datalist. This is the code. I have 2linkbuttons and it depends of a field to show one or the other. The IF clause is OK, but its showing me the links in BLACK not in blue! and they are...
4
by: Miguel Dias Moura | last post by:
Hello, I created a datalist in an ASP.Net / VB page. I display the image and price of a few products. When a user clicks an image I want to load the page "detail.aspx?number=id" and send the...
1
by: Nathan Sokalski | last post by:
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"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.