473,324 Members | 2,456 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,324 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 21 '05 #1
1 1357
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 21 '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...
2
by: Its_Me_SunnY | last post by:
Hi, can any one help me how to make a cell in data grid link to another page.... like i have a field "refno" in my table so when in get the values from table to datagrid the refno's of every...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.