Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    vancouver, BC, Br. Columbia
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MailTo hyperlink in a datagrid (.NET framework 1.1)

    I have a datagrid with contact information including email address. Does anyone know if there is a way to convert the email address to a Mailto: hyperlink so that when you click on it, it creates a message form with the addressee filled in?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MailTo hyperlink in a datagrid (.NET framework 1.1)

    There are several ways to approach this. Both involve using a Template column instead of a Bound column.

    1) Create a Template Column for the desired item
    2) Create the <ItemTemplate></ItemTemplate> tags for the content
    3)
    a) Add an <asp:Hyperlink></asp:Hyperlink> item, using <%# "mailto:" & DataBinder.Eval(Container, "DataItem.EmailAddressFieldName") %> as the NavigateURL and Text attributes OR
    [img]/forums/images/smilies/cool.gif[/img] Manually create the hyperlink field like such: <%# DataBinder.Eval(Container, "DataItem.EmailAddressFieldName") %>

    (Note: You have to use Single quotes around any item that has double quotes within it - such as the href='' attribute above)

    Either of these techniques for #3 will work pretty well... Don't forget that you can also add "?subject=A Subject" after the Email address to populate the Subject line as well...

    Hope this helps!

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Location
    vancouver, BC, Br. Columbia
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: MailTo hyperlink in a datagrid (.NET framework 1.1)

    MarkJ, Thank you! I've looked <span style="background-color: #FFFF00; color: #000000; font-weight: bold">everywhere</span hi> on-line and in the Help files and couldn't come up with this!
    Thanks to you, the application is sailing along again! <img src=/S/sailing.gif border=0 alt=sailing width=25 height=25>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •