Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2005, 09:31 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default Hyperlinks in a grid

I have a datagrid with various details of contractors, I would like to have the column containing the contractors names to be hyperlinks to link to a form containing the contractors full details. How do I do this as I don't want to further buttons in the grid.

Thanks

Louisa

 
Old August 11th, 2005, 10:52 AM
Authorized User
 
Join Date: May 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Louisa

I'm no expert, but assuming your have AutoGenerateColumns="false" within the datagrid, you would then set up a column, with something like the following:

<columns>
  <asp:TemplateColumn HeaderText="Contractor">
    <itemtemplate>
        <a href="[formpage].aspx?id=('<%# DataBinder.Eval(Container.DataItem, "[contractorID_Field]") %>');"><%# DataBinder.Eval(Container.DataItem, "[contractorName_Field]") %></a>
  </itemtemplate>
</asp:TemplateColumn>

Without knowing what your database field names are, it's hard to map them above, and also, without knowing how you want to link them, ie, is it one form page which is populated based on the contractor (in which case you could send the contractorID to that form page and use a Request.QueryString on the form page to get it, or have you got multiple pages, ie, one for each contractor?

 
Old August 14th, 2005, 12:26 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Add a hyperlink column to your grid using the Property Builer, then set the various properties there.

 
Old August 15th, 2005, 04:18 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 130
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi

I continued to alter the code and it now works brilliantly thanks very much for you help

Louisa






Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlinks stephens1982 HTML Code Clinic 1 August 29th, 2005 12:13 AM
hyperlinks in XSLT, please help. figit XSLT 1 May 6th, 2005 03:06 AM
Hyperlinks bahachin Excel VBA 2 February 13th, 2005 04:50 AM
hyperlinks problem sbhandar Classic ASP Basics 2 September 2nd, 2004 07:18 PM
hyperlinks sbhandar Classic ASP Basics 4 August 19th, 2004 09:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.