Hi,
I want to create a mailto link from data coming from an SQLDataSource. How
do I have to change the following code to get it working? The mailto works,
outlook starts with a new message, but the email address has not been filled
in because I don’t know how to pass the email variable into the mailto
command.
<asp:HyperLin k runat="server">
<A href="mailto:">
<asp:Label ID="EmailLabel " runat="server" Text='<%# Bind("Email")
%>'></asp:Label><br />
</asp:Hyperlink>
</A>
Thanks in advance,
Regards,
Peter 2 6327
Peter,
The Bind() and Eval() functions take an optional format string that can be
used to format the data that is bound to a target property. In your case you
can format the NavigateUrl on a Hyperlink control to be something like
"mailto:ya**@xy z.com". Change your Bind(..) or Eval(..) call to
Bind("Email", "mailto:{0} "). The token {0} in the format string is replaced
the value of "Email" from your SqlDataSource.
Also, binding to SqlDataSource only works with server controls that support
Data Binding (Server controls that have a DataSourceID, such as the GridView,
FormView, DetailsView, DropDownList, CheckBoxList, BulletedList, etc.).
Here is an example of a GridView that has a bound mailto column using a
Hyperlink control.
Hope this helps,
Jason Vermillion
<asp:GridView ID="GridView1" runat="server" DataSourceID="S qlDataSource1"
AutoGenerateCol umns="False">
<Columns>
<asp:TemplateFi eld HeaderText="Bin ding Using a format string">
<ItemTemplate >
<asp:HyperLin k ID="lnkEmail" runat="server" NavigateUrl='<% #
Eval("Email", "mailto:{0} ") %>' Text='<%# Eval("Email", "Send an Email to
{0}") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>
Hi,
I want to create a mailto link from data coming from an SQLDataSource. How
do I have to change the following code to get it working? The mailto works,
outlook starts with a new message, but the email address has not been filled
in because I don’t know how to pass the email variable into the mailto
command.
<asp:HyperLin k runat="server">
<A href="mailto:">
<asp:Label ID="EmailLabel " runat="server" Text='<%# Bind("Email")
%>'></asp:Label><br />
</asp:Hyperlink>
</A>
Thanks in advance,
Regards,
Peter
Thanks a lot Jason. It works.
Regards,
Peter
"Jason Vermillion" wrote:
Peter,
The Bind() and Eval() functions take an optional format string that can be
used to format the data that is bound to a target property. In your case you
can format the NavigateUrl on a Hyperlink control to be something like
"mailto:ya**@xy z.com". Change your Bind(..) or Eval(..) call to
Bind("Email", "mailto:{0} "). The token {0} in the format string is replaced
the value of "Email" from your SqlDataSource.
Also, binding to SqlDataSource only works with server controls that support
Data Binding (Server controls that have a DataSourceID, such as the GridView,
FormView, DetailsView, DropDownList, CheckBoxList, BulletedList, etc.).
Here is an example of a GridView that has a bound mailto column using a
Hyperlink control.
Hope this helps,
Jason Vermillion
<asp:GridView ID="GridView1" runat="server" DataSourceID="S qlDataSource1"
AutoGenerateCol umns="False">
<Columns>
<asp:TemplateFi eld HeaderText="Bin ding Using a format string">
<ItemTemplate >
<asp:HyperLin k ID="lnkEmail" runat="server" NavigateUrl='<% #
Eval("Email", "mailto:{0} ") %>' Text='<%# Eval("Email", "Send an Email to
{0}") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>
Hi,
I want to create a mailto link from data coming from an SQLDataSource. How
do I have to change the following code to get it working? The mailto works,
outlook starts with a new message, but the email address has not been filled
in because I don’t know how to pass the email variable into the mailto
command.
<asp:HyperLin k runat="server">
<A href="mailto:">
<asp:Label ID="EmailLabel " runat="server" Text='<%# Bind("Email")
%>'></asp:Label><br />
</asp:Hyperlink>
</A>
Thanks in advance,
Regards,
Peter
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ElvisIsDead |
last post by:
Have a script that takes a form and emails it automatically. Here is the part:
<form onSubmit="return editData();" name="estm" enctype="text/plain" method="post" action="mailto:user@domain.com?subject=Daily numbers&body=window.this.document">
I would like for it to open the default email program and let me choose an address from that form. Is this possible? Any suggestions are appreciated.
Elvis
|
by: Shinin |
last post by:
I am trying to set up a mailto: link so that the actual address that
the email is being sent to is obscured and replaced by a name. For
example, I have <a href="mailto:jschmoe@abc.com">Joe Schmoe</a>. When
this link is clicked, an email window appears in the clicker's email
client where the To: field is jschmoe@abc.com. What I want to have
displayed there is Joe Schmoe. I've seen it suggested that formatting
the link like this: <a...
|
by: Brian Bischof |
last post by:
I'm have a form with a datagrid showing a checkbox for each row. I want the
user to be able to click a checkbox and then click a button that sends an
email similar to how the HREF MailTo: works. I can't embed the MailTo: in
the webpage b/c the button has to determine which row has a checkbox, pull
data from SQL and then build the email content. I originally wrote the code
using System.Web.Mail classes but the client doesn't like it b/c they...
|
by: Timm |
last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative
data binding wherever possible and trying to minimize the use of code. The
list of values in DropDownList DDL2 should be (filtered) dependent upon the
selection in DDL1. I think this inevitably needs some code, but I'd be happy
to be told otherwise!
I have some code to handle OnSelectedIndexChanged for DDL1 that sets the
FilterExpression associated with the...
|
by: |
last post by:
Hello,
Does anyone have an idea on how I can filter the data in the gridview
control that was returned by an sql query?
I have a gridview that works fine when I populate it with data. Now I want
to look at that data and filter it based on what is in it.
I know that this could have been done with data sets and data views in
asp.net 1.1 but how is this done now in asp.net 2.0?
| |
by: trichert |
last post by:
Ok , developing a .aspx page with Visual Web Studio (the full page is
at the bottom). Basically its a page that displays all my computers
and the current logged on user pulling data from a live Altiris
database.
This works fine, i have added a feature with a link for me to click to
run radmin against that computer so i can remote control it.
The link shows properly when I hover over it
"S:\apps\!drivers\WindowsETC\rview.bat PCNAME". ...
|
by: RAR in WA |
last post by:
I'm moving to .Net framework 2.0 from Visual Studio 2002/3 with more time on
desktop apps than ASP.Net, although I have done a small amount in ASP.Net. Is
best practice for ASP.Net now to use the components for data access, or to
build your own connection and command objects in code? I find working with
the designer to be awkward and hard to follow the details, and would like to
know if I really should get used to doing things with...
|
by: Ken Fine |
last post by:
I'm using SQLDataSource, which generates some kind of dataset, and then I
attach that datasource to various data display controls such as DataList and
repeater which loop through to the end of the data that was retrieved by the
query.
At times I may want the display control only to render some items in the set
of data returned by SqlDataSource. There would be several scenarios:
* render the second data item or third item in to the end...
|
by: Corey B |
last post by:
I have a page with a DetailsView control and a SQLDataSource control.
The SQLDataSource control is connected to an Access database.
Everything works fine. Now I want to change the back end database from
Access to SQL Server. So I go in to the SQLDataSource and modify it to
connect to the SQL Server database. No problem. However, the
DetailsView control does not seem to pick up the changes. When I click
on the little shortcut menu (not...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |