Another easy one: make a column into a hyperlink.

Discussion in 'ASP .Net' started by Jason, Jul 28, 2004.

  1. Jason

    Jason Guest

    I have an asp.net page that has a datagrid on it. The datagrid is populated
    at runtime from Active Directory.

    I need to set one of the columns as a hyperlink while appending a mailto to
    the data within that particular column's cell.

    That is, if the column is named 'Email' and one of the rows is
    '' I need to be able to click on
    and it will invoke a 'mailto:'
    as a hyperlink.

    Thoughts?

    Thanks in advance,

    Jay
    Jason, Jul 28, 2004
    #1
    1. Advertising

  2. Well I know that in design mode you can format an item cell in the datagrid. So, to my knowledge what ever you can do in design mode, you can do through code. But, this may take a little more patience to do. I am intrested to see how this can be done as well

    "Jason" wrote:

    > I have an asp.net page that has a datagrid on it. The datagrid is populated
    > at runtime from Active Directory.
    >
    > I need to set one of the columns as a hyperlink while appending a mailto to
    > the data within that particular column's cell.
    >
    > That is, if the column is named 'Email' and one of the rows is
    > '' I need to be able to click on
    > and it will invoke a 'mailto:'
    > as a hyperlink.
    >
    > Thoughts?
    >
    > Thanks in advance,
    >
    > Jay
    >
    >
    >
    =?Utf-8?B?VGFtcGEgLk5FVCBLb2Rlcg==?=, Jul 28, 2004
    #2
    1. Advertising

  3. lookup the hyperlinkcolumn

    <asp:DataGrid id="ContainerID" runat="server" autogeneratecolumns="false" >
    <columns>
    <asp:HyperLinkColumn
    DataTextField="Email"
    HeaderText="Email"
    DataNavigateUrlFormatString="mailto:{0}"
    DataNavigateUrlField="EmailField" />
    </columns>
    </asp:DataGrid>

    --
    Regards

    John Timney
    Microsoft Regional Director
    Microsoft MVP


    "Jason" <> wrote in message
    news:e#...
    > I have an asp.net page that has a datagrid on it. The datagrid is

    populated
    > at runtime from Active Directory.
    >
    > I need to set one of the columns as a hyperlink while appending a mailto

    to
    > the data within that particular column's cell.
    >
    > That is, if the column is named 'Email' and one of the rows is
    > '' I need to be able to click on
    > and it will invoke a

    'mailto:'
    > as a hyperlink.
    >
    > Thoughts?
    >
    > Thanks in advance,
    >
    > Jay
    >
    >
    John Timney \(Microsoft MVP\), Jul 28, 2004
    #3
  4. Jason

    Jason Guest

    It was the DataTextField="Email" I was missing to specify an existing data
    column rather than creating a new one. Works like a charm.

    Thanks a million John.

    "John Timney (Microsoft MVP)" <> wrote in message
    news:...
    > lookup the hyperlinkcolumn
    >
    > <asp:DataGrid id="ContainerID" runat="server" autogeneratecolumns="false"
    >
    > <columns>
    > <asp:HyperLinkColumn
    > DataTextField="Email"
    > HeaderText="Email"
    > DataNavigateUrlFormatString="mailto:{0}"
    > DataNavigateUrlField="EmailField" />
    > </columns>
    > </asp:DataGrid>
    >
    > --
    > Regards
    >
    > John Timney
    > Microsoft Regional Director
    > Microsoft MVP
    >
    >
    > "Jason" <> wrote in message
    > news:e#...
    > > I have an asp.net page that has a datagrid on it. The datagrid is

    > populated
    > > at runtime from Active Directory.
    > >
    > > I need to set one of the columns as a hyperlink while appending a mailto

    > to
    > > the data within that particular column's cell.
    > >
    > > That is, if the column is named 'Email' and one of the rows is
    > > '' I need to be able to click on
    > > and it will invoke a

    > 'mailto:'
    > > as a hyperlink.
    > >
    > > Thoughts?
    > >
    > > Thanks in advance,
    > >
    > > Jay
    > >
    > >

    >
    >
    Jason, Jul 28, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?V2FyYW4=?=

    HyperLink Column and Button Column in a DataGrid

    =?Utf-8?B?V2FyYW4=?=, Aug 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    600
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  2. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    1,006
    deandany
    Jul 17, 2006
  3. davetichenor
    Replies:
    1
    Views:
    819
    Eliyahu Goldin
    Oct 30, 2006
  4. Keith G Hicks
    Replies:
    3
    Views:
    763
    Keith G Hicks
    Feb 18, 2008
  5. Dave
    Replies:
    0
    Views:
    935
Loading...

Share This Page