Hi,
According to the mentioned blog You can try something like this:
GridView gv = new GridView() { AutoGenerateColumns = false };
Page.Form.Controls.Add(gv);
var list = new[]
{
new {Name = "John Smith", EMail = ""},
new {Name = "John Doe", EMail = ""},
new {Name = "Jane Doe", EMail = ""}
};
BoundField f1 = new BoundField() { DataField = "Name",
HeaderText = "Name" };
TemplateField f2 = new TemplateField();
f2.ItemTemplate = Page.LoadTemplate("EMailTemplate.ascx");
f2.HeaderText = "e-mail";
gv.Columns.Clear();
gv.Columns.Add(f1);
gv.Columns.Add(f2);
gv.DataSource = list;
gv.DataBind();
Also create a web user control EMailTemplate, and put the hyperlink field
into it (see below)
(the Control tag might differ according Your application name)
--------------------------------------- Contents of EMailTemplate.ascx
<%@ Control Language="C#" AutoEventWireup="true"
CodeBehind="EMailTemplate.ascx.cs"
Inherits="YourWebApplication.EMailTemplate" %>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%#
Eval("EMail","mailto:{0}") %>' > <%# Eval("EMail") %> </asp:HyperLink>
Hope You find this useful.
-Zsolt
"HRsoft Informática" <> wrote in
message news:C4B3D39C-E565-455C-BC56-...
> Thanks for your response. But I need to create dynamically, on .VB 2008. I
> try this:
>
> Dim coluna11 As New HyperLinkField
>
> coluna11.DataTextField = "s_email"
> coluna11.HeaderText = "Email"
> coluna11.Text = "<%# Eval('s_Email') %>"
> coluna11.NavigateUrl = "<%# Eval('s_Email', 'mailto:{0}') %>"
> 'coluna11.DataNavigateUrlFields = "s_email"
> coluna11.ItemStyle.Wrap = False
>
> With this code, the content of the column change color to hyperlink color
> (
> according to .CSS), but no redirect or link to outlook, etc, ie, nothing
> happens.
>
> --
> Hércules
> HRsoft Informática - Rio de Janeiro - Brasil
> http://www.hrsoft.com.br
>
>
>
> "Mark Rae [MVP]" wrote:
>
>> "HRsoft Informática" <> wrote
>> in
>> message news:C98B76D8-A913-4EF8-B5F2-...
>>
>> > I need this column, an email, hyperlinked like: mailto
the content of
>> > the
>> > column)
>>
>> http://dotnetspidor.blogspot.com/200...ddress-in.html
>>
>>
>> --
>> Mark Rae
>> ASP.NET MVP
>> http://www.markrae.net
>>
>>