Adding a href link to a column in a data grid

Discussion in 'ASP .Net Datagrid Control' started by Vasantha peddireddy, Aug 23, 2005.

  1. Hi,

    I am trying to figure out how I can add a html link to a value (which is the
    virtual path of a file) in the data grid column. I have code as below. Please
    help!

    <asp:DataGrid id="DataGrid1" BorderColor="black" BorderWidth="1"
    CellPadding="3" AutoGenerateColumns="false"
    runat="server" AllowPaging="True" ItemStyle-Wrap=true>
    <HeaderStyle BackColor="#00AAAA"></HeaderStyle>
    <Columns>
    <asp:BoundColumn DataField="VPath"
    HeaderText="VPath"></asp:BoundColumn>
    </column>
    </asp:Datagrid>
     
    Vasantha peddireddy, Aug 23, 2005
    #1
    1. Advertisements

  2. Vasantha peddireddy

    Elton Wang Guest

    Try HyperLinkColumn:

    <asp:HyperLinkColumn DataTextField="VPath" HeaderText="Link"
    DataNavigateUrlField="VPath"
    DataNavigateUrlFormatString="page.aspx?path={0}">
    </asp:HyperLinkColumn>


    "Vasantha peddireddy" <> wrote
    in message news:...
    > Hi,
    >
    > I am trying to figure out how I can add a html link to a value (which is

    the
    > virtual path of a file) in the data grid column. I have code as below.

    Please
    > help!
    >
    > <asp:DataGrid id="DataGrid1" BorderColor="black" BorderWidth="1"
    > CellPadding="3" AutoGenerateColumns="false"
    > runat="server" AllowPaging="True" ItemStyle-Wrap=true>
    > <HeaderStyle BackColor="#00AAAA"></HeaderStyle>
    > <Columns>
    > <asp:BoundColumn DataField="VPath"
    > HeaderText="VPath"></asp:BoundColumn>
    > </column>
    > </asp:Datagrid>
     
    Elton Wang, Aug 23, 2005
    #2
    1. Advertisements

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. John Doe

    Converting a column in a grid to link

    John Doe, Oct 22, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    518
    John Doe
    Oct 22, 2003
  2. Vikramaditya Singh

    adding serial no column in a bounded data grid

    Vikramaditya Singh, Jan 28, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    3,645
    Saravana [MVP]
    Jan 28, 2004
  3. C Newby
    Replies:
    7
    Views:
    812
    C Newby
    Apr 2, 2004
  4. carlos perez
    Replies:
    0
    Views:
    571
    carlos perez
    Jun 8, 2004
  5. =?Utf-8?B?QWJoaXNoZWs=?=
    Replies:
    1
    Views:
    1,532
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Mar 24, 2006
  6. Glenn
    Replies:
    2
    Views:
    538
    Jeff Dillon
    May 15, 2006
  7. parez
    Replies:
    1
    Views:
    824
    parez
    Jul 19, 2006
  8. Jeff
    Replies:
    0
    Views:
    512
Loading...