|
Subject:
|
Hyperlinks in a grid
|
|
Posted By:
|
Louisa
|
Post Date:
|
8/11/2005 9:31:46 AM
|
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
|
|
Reply By:
|
s.hendy
|
Reply Date:
|
8/11/2005 10:52:34 AM
|
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?
|
|
Reply By:
|
jbenson001
|
Reply Date:
|
8/14/2005 12:26:11 AM
|
Add a hyperlink column to your grid using the Property Builer, then set the various properties there.
|
|
Reply By:
|
Louisa
|
Reply Date:
|
8/15/2005 4:18:28 AM
|
Hi
I continued to alter the code and it now works brilliantly thanks very much for you help
Louisa
|