473,796 Members | 2,904 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to use Eval with mailto?

hi,all.

i wanna use Eval("DataField ") to bind datarow in item template of GridView.

for example:
<asp:Label runat="server" id="Label1" text='<%# Eval("DataField ")
%>'><asp:Label >

but how to use eval with control HyperLink?

<asp:HyperLin k runat="server" id="email" NavigateUrl='ma ilto:<%#
Eval("Email") %>'>Email</asp:HyperLink>

Please watch property NavigateUrl.whe n i use mailto,there is no syntax
error.but i debug it , i saw that hyperlink's navigateurl didn't bind
datafield Email.how to use eval with mailto?
May 25 '06 #1
2 10342
When you want the output of an Eval to be something other than the exact
data from the datasource, do something like this:
<asp:HyperLin k id="lnkEmail" runat="server" text='<%#
DataBinder.Eval (Container, "DataItem.email ") %>' NavigateUrl='<% #
DataBinder.Eval (Container, "DataItem.email ","MAILTO:{ 0}")
%>'></asp:HyperLink>
Notice that in the Eval used in the NavigateUrl there are three parameters:

Container (this will always be the same, do not change it)
"DataItem.email "
"MAILTO:{0} "

In the last parameter, create a string which formats the output. Place {0}
wherever you want the data from the datasource to appear. For example, in my
example, you would get something like:

MAILTO:nj****** **@hotmail.com

For more detail, see the documentation. If you have any questions, feel free
to ask and I will do my best to help. Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Arvan" <es***@126.co m> wrote in message
news:O7******** ******@TK2MSFTN GP03.phx.gbl...
hi,all.

i wanna use Eval("DataField ") to bind datarow in item template of
GridView.

for example:
<asp:Label runat="server" id="Label1" text='<%# Eval("DataField ")
%>'><asp:Label >

but how to use eval with control HyperLink?

<asp:HyperLin k runat="server" id="email" NavigateUrl='ma ilto:<%#
Eval("Email") %>'>Email</asp:HyperLink>

Please watch property NavigateUrl.whe n i use mailto,there is no syntax
error.but i debug it , i saw that hyperlink's navigateurl didn't bind
datafield Email.how to use eval with mailto?

May 25 '06 #2
Thank you very much!!!

"Nathan Sokalski" <nj********@hot mail.com> дÈëÏûÏ¢ÐÂÎÅ:eO **************@ TK2MSFTNGP02.ph x.gbl...
When you want the output of an Eval to be something other than the exact
data from the datasource, do something like this:
<asp:HyperLin k id="lnkEmail" runat="server" text='<%#
DataBinder.Eval (Container, "DataItem.email ") %>' NavigateUrl='<% #
DataBinder.Eval (Container, "DataItem.email ","MAILTO:{ 0}")
%>'></asp:HyperLink>
Notice that in the Eval used in the NavigateUrl there are three
parameters:

Container (this will always be the same, do not change it)
"DataItem.email "
"MAILTO:{0} "

In the last parameter, create a string which formats the output. Place {0}
wherever you want the data from the datasource to appear. For example, in
my example, you would get something like:

MAILTO:nj****** **@hotmail.com

For more detail, see the documentation. If you have any questions, feel
free to ask and I will do my best to help. Good Luck!
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Arvan" <es***@126.co m> wrote in message
news:O7******** ******@TK2MSFTN GP03.phx.gbl...
hi,all.

i wanna use Eval("DataField ") to bind datarow in item template of
GridView.

for example:
<asp:Label runat="server" id="Label1" text='<%# Eval("DataField ")
%>'><asp:Label >

but how to use eval with control HyperLink?

<asp:HyperLin k runat="server" id="email" NavigateUrl='ma ilto:<%#
Eval("Email") %>'>Email</asp:HyperLink>

Please watch property NavigateUrl.whe n i use mailto,there is no syntax
error.but i debug it , i saw that hyperlink's navigateurl didn't bind
datafield Email.how to use eval with mailto?


May 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
29921
by: Val | last post by:
Any experts on mailto: tags? I want to set a link so that the subject and some of the body of the email is filled in. This is easy for simple text, although you need to use %20 for spaces: <a href="mailto:nobody@nowhere.com ?subject=Your web site &body=This%20is%20the%20%body!"> click here</a>
7
4112
by: Reply Via Newsgroup | last post by:
This might sound sad... someone requesting a disertation on the 'eval' statement... but... I've been reading someone else's post - they had a huge calander like script and a handful of folk cursed the script and special attention was thrown at the fact the script used eval alot. I don't use eval alot in my scripts - but I do use it - and since I always out to learn more / improve my javascript skills, I'm curious why something I thought...
10
17303
by: Adam Smith | last post by:
How can I set up a mailto with a cc or bcc as well as a subject designation. The system works for two but not three, is this a hardwired limit or have I missed something ==> <a href="mailto:registrar@econ.com?cc=webmaster@econ.com?subject=Login Problems">The Registrar at econ.com</a>
11
1886
by: sneill | last post by:
I have read a number of posts on the use of eval() in Javascript, and I agree that its use is questionable. But it does beg the following question: "How arbitrary does a string need to be before the use of eval() is required to execute it?" Given the following code, I'm able to evaluate/execute most expressions like: "a.b.c.d()"
1
2014
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" 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...
15
3668
by: manstey | last post by:
Hi, I have a text file called a.txt: # comments I read it using this:
3
1923
by: Pauljh | last post by:
Hi All, I'm running some javascript over a server side generated web page and have multiple generated empty select statements, that I want to populate when the page is loaded. As HTML doesn't do arrays each select is individually named withe MySelecti where i is an incremental from 1. I know all my variables are correct (i, OptionsCount) and my arrays of MyValues and MyDescription's exist for multiple enteries and if I bring out an...
6
5932
by: RandomElle | last post by:
Hi there I'm hoping someone can help me out with the use of the Eval function. I am using Access2003 under WinXP Pro. I can successfully use the Eval function and get it to call any function with or without parms. I know that any function that is passed to Eval() must be declared Public. It can be a Sub or Function, as long as it's Public. I even have it where the "function" evaluated by Eval can be in a form (class) module or in a standard...
10
494
by: Gordon | last post by:
I have a script that creates new objects based on the value of a form field. Basically, the code looks like this. eval ('new ' + objType.value + '(val1, val2, val3'); objType is a select with the different types of objects you can create as values. I really don't like using eval, and it's causing problems, like if I do something like the following:
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10244
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10201
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4130
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.