embedding <a href > tag in DataGrid

Discussion in 'ASP .Net' started by =?Utf-8?B?T3V0bG9va05ld2JpZURldg==?=, Aug 24, 2005.

  1. Hello,

    I'm new to ASP.NET but have done quite a bit of classic ASP. I need to
    drill down to another page from the DataGrid using a record's ID. In classic
    ASP, this was quite easy but I can't find anything equivalent in ASP.NET.

    For example, I need to go from a page that lists Customers to a page for
    CustomerDetails by allowing the user to click anywhere on the row of the
    DataGrid.

    I've read about using a TemplateColumn and a lable but it doesn't look like
    the same functionality. Any help is very much appreciated.

    Regards,

    ASP.NET Newbie
     
    =?Utf-8?B?T3V0bG9va05ld2JpZURldg==?=, Aug 24, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?T3V0bG9va05ld2JpZURldg==?=

    tom pester Guest

    Hi newbie :)

    <asp:DataGrid ID="dg" runat="server" DataSourceID="SqlDataSource1">
    <Columns>
    <asp:HyperLinkColumn DataNavigateUrlField="ProductID"
    DataNavigateUrlFormatString="details.aspx?id={0}"
    Text="More Details"></asp:HyperLinkColumn>
    </Columns>
    </asp:DataGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString1 %>"
    SelectCommand="SELECT [ProductID], [ProductName], [SupplierID],
    [CategoryID], [QuantityPerUnit] FROM [Alphabetical list of products]">
    </asp:SqlDataSource>

    That code uses the version 2 datasource control but its the hyperlinkColumn
    that you are intrested in.


    Let me know if it helped you or not...

    Cheers,
    Tom Pester

    > Hello,
    >
    > I'm new to ASP.NET but have done quite a bit of classic ASP. I need
    > to drill down to another page from the DataGrid using a record's ID.
    > In classic ASP, this was quite easy but I can't find anything
    > equivalent in ASP.NET.
    >
    > For example, I need to go from a page that lists Customers to a page
    > for CustomerDetails by allowing the user to click anywhere on the row
    > of the DataGrid.
    >
    > I've read about using a TemplateColumn and a lable but it doesn't look
    > like the same functionality. Any help is very much appreciated.
    >
    > Regards,
    >
    > ASP.NET Newbie
    >
     
    tom pester, Aug 24, 2005
    #2
    1. Advertising

  3. Tom,

    Thank you very much for the example. The HyperLinkColumn tag worked out
    perfectly!

    Regards,

    The Newbie


    "tom pester" wrote:

    > Hi newbie :)
    >
    > <asp:DataGrid ID="dg" runat="server" DataSourceID="SqlDataSource1">
    > <Columns>
    > <asp:HyperLinkColumn DataNavigateUrlField="ProductID"
    > DataNavigateUrlFormatString="details.aspx?id={0}"
    > Text="More Details"></asp:HyperLinkColumn>
    > </Columns>
    > </asp:DataGrid><asp:SqlDataSource ID="SqlDataSource1" runat="server"
    > ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString1 %>"
    > SelectCommand="SELECT [ProductID], [ProductName], [SupplierID],
    > [CategoryID], [QuantityPerUnit] FROM [Alphabetical list of products]">
    > </asp:SqlDataSource>
    >
    > That code uses the version 2 datasource control but its the hyperlinkColumn
    > that you are intrested in.
    >
    >
    > Let me know if it helped you or not...
    >
    > Cheers,
    > Tom Pester
    >
    > > Hello,
    > >
    > > I'm new to ASP.NET but have done quite a bit of classic ASP. I need
    > > to drill down to another page from the DataGrid using a record's ID.
    > > In classic ASP, this was quite easy but I can't find anything
    > > equivalent in ASP.NET.
    > >
    > > For example, I need to go from a page that lists Customers to a page
    > > for CustomerDetails by allowing the user to click anywhere on the row
    > > of the DataGrid.
    > >
    > > I've read about using a TemplateColumn and a lable but it doesn't look
    > > like the same functionality. Any help is very much appreciated.
    > >
    > > Regards,
    > >
    > > ASP.NET Newbie
    > >

    >
    >
    >
     
    =?Utf-8?B?T3V0bG9va05ld2JpZURldg==?=, Aug 24, 2005
    #3
    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. shruds
    Replies:
    1
    Views:
    836
    John C. Bollinger
    Jan 27, 2006
  2. CRON
    Replies:
    24
    Views:
    200,850
    Adrienne Boswell
    Jun 20, 2006
  3. OutlookNewbieDev

    embedding <a href > tag in DataGrid

    OutlookNewbieDev, Aug 24, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    109
    OutlookNewbieDev
    Aug 24, 2005
  4. Soren Vejrum
    Replies:
    4
    Views:
    630
    Lasse Reichstein Nielsen
    Jul 5, 2003
  5. saiho.yuen
    Replies:
    3
    Views:
    437
    kaeli
    Sep 14, 2004
Loading...

Share This Page