How to get a Datagrid cell content on the aspx

  • Thread starter Thread starter Pedro
  • Start date Start date
P

Pedro

Hi,

I have a datagrid with a column of LinkButtons
(Id=emaillink) that contains email links
([email protected]).
I wanted that when someone click on that link, the default
email application was invoked and allow the user to send a
email to that address.

How can I access the text of that cell so I can, on the
aspx not the codebehind?
I was trying to involve that cell with a <a
href="mailto:emaillink.Text" runat=server>
But isn't working, what can I do?

Thanks in advance

Pedro
 
Hi Pedro,

how about something like this -

<asp:HyperLinkColumn Text="Email"
DataNavigateUrlField="email"
DataNavigateUrlFormatString="mailto:{0}"
HeaderText="Email"></asp:HyperLinkColumn>

HTH.

Kaustav Neogy.
 
Hi Kaustav,

It thosen't work because a datagrid thosen't have
HyperLinkColumn.

I already try this:
<asp:TemplateColumn HeaderText="Pedido Por">

<HeaderStyle CssClass="menuTop"></HeaderStyle>
<ItemStyle
HorizontalAlign="Left"></ItemStyle>

<ItemTemplate>

<asp:HyperLink CssClass=texto runat="server"
NavigateUrl='mailto:<%# DataBinder.Eval
(Container, "DataItem.UtilizadorPedido" ) %>' text='<%#
DataBinder.Eval(Container, "DataItem.UtilizadorPedido" ) %
' Font-Underline=False ID="PedidoPor">

</asp:HyperLink>

</ItemTemplate>

<EditItemTemplate>

</EditItemTemplate>

</asp:TemplateColumn>

and this:
<asp:TemplateColumn HeaderText="Pedido Por">

<HeaderStyle CssClass="header3"></HeaderStyle>
<ItemStyle
HorizontalAlign="Left"></ItemStyle>

<ItemTemplate>
<a
runat="server" id="refMail" href="mailto:<%=
PedidoPor.Text %>">

<asp:Label CssClass=texto runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.UtilizadorPedido" ) %
' ID="PedidoPor">

</asp:Label>

</a>

</ItemTemplate>

<EditItemTemplate>

</EditItemTemplate>

</asp:TemplateColumn>

But none work.
 
Back
Top