Hi Nahom,
Does our suggest help you some? If anything else we can help, please feel
free to post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Elton Wang" <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
<
[email protected]>
| Subject: Re: How to use Eval / Bind to create a mailto link?
| Date: Mon, 16 Jan 2006 09:08:21 -0500
| Lines: 113
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Original
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: 204.101.136.100
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:15076
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Hi Steven,
|
| Good suggestion! Thanks.
|
| Elton
|
| | > Thanks for Elton's good suggestion.
| >
| > Hi Elton,
| >
| > For your scenario that we need advanced customization on the hyperlink
| > control's column, I'd suggest you consider using Template Column(field),
| > thus, we can either use the RowDataBound event to find the control and
set
| > the property or fields we want (as Elton has demonstrated....) or
define
| > a
| > helper function in page class and use it in Data Bound template (aspx )
| > inline. e.g:
| >
| > <asp:HyperLink ID="email" runat="server" NavigateUrl='<%# HelperFunc(
| > Container.DataItem) %>'>Email me</asp:HyperLink>
| >
| >
| > HelperFunc is a helper function defined in page class which accept the
| > databound item and return a string to represent the url string....
| >
| > Hope also helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure!
www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| > --------------------
| > | From: "Elton Wang" <
[email protected]>
| > | References: <
[email protected]>
| > | Subject: Re: How to use Eval / Bind to create a mailto link?
| > | Date: Sun, 15 Jan 2006 15:21:29 -0500
| > | Lines: 45
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| > | X-RFC2646: Format=Flowed; Original
| > | Message-ID: <
[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > | NNTP-Posting-Host: 69.158.28.148
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.datagridcontrol:15072
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > |
| > | Hi Nahom,
| > |
| > | Although GridView supports multi-parameters in its HyperLinkField,
it's
| > for
| > | Hyperlink rather than for mailto link. You need use
| > GridView_RowDataBound
| > | event to build mailto link like follows:
| > |
| > | if (e.Row.RowType == DataControlRowType.DataRow)
| > | {
| > | DataRowView drv = e.Row.DataItem as DataRowView;
| > | HyperLink link =
e.Row.Cells[link_field_index].Controls[0]
| > as
| > | HyperLink;
| > | link.NavigateUrl = "mailto:" +
| > drv["mail_address"].ToString()
| > +
| > | "?subject=" + drv["subject"].ToString();
| > | }
| > |
| > | HTH
| > |
| > | | > | > Hi,
| > | >
| > | > In my gridview or datalist control, I know how to use the Eval or
Bind
| > | > method to bind a control property to a data as follows:
| > | > <asp:HyperLink ID="email" runat="server" NavigateUrl='<%#
| > Eval("email",
| > | > "mailto:{0}") %>'>Email me</asp:HyperLink>
| > | > would give result as <a href="mailto:
[email protected]">Email me</a>
| > | >
| > | > But is it possible to get a mailto output as below?
| > | > <a href="mailto:
[email protected]?subject=contact Us">Email me</a>
| > | >
| > | > Here, the difference is that I am trying to bind 2 different data
| > values
| > | > to
| > | > the same property of the control, one for the response email
address,
| > and
| > | > another for the subject.
| > | > mailto:<email from db>?subject=<category from db>
| > | >
| > | > Is this possible, and how could this be done?
| > | >
| > | > Thanks in advance.
| > | >
| > | > --
| > | > Nahom Tijnam
| > | > Dubai, UAE
| > |
| > |
| > |
| >
|
|
|