Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a table as follows:

Upload

CategoryId int
description nvarchar(50)
path nvarchar(50)

the category indicates the categories of files whose description and path are provided.

ex. A category can be employee which might have various employee desc and their file paths.

Now i want to show these in grid view. In Grid View , I want to have a Hyperlink Field which on clicking would download the file with respect to the path.

ex i fetched records with cat employee. It fetched 10 rows. Now what i need is every row in grid view has a link download with it's respective path.

Please help!!!
Posted
Updated 13-Oct-13 21:00pm
v2

Hey there,

Check these links on how to use asp:HyperlinkField:
http://www.ezzylearning.com/tutorial.aspx?tid=8093456[^]

how to add Hyperlink in gridview in ASP.NET[^]

Let me know if it helps.

Azee...
 
Share this answer
 
 
Share this answer
 
C#
you can follows these steps..
1. Add a TemplateField in the Selected Fields list.
 
2. Now Right click on the Grid and select Edit Templates. Now drop the
Hyperlink control in the ItemTemplate of the Grid.
 
3. Now bind the NavigateURL and Text property of the Hyperlink to the
hyperlink column field in the table using Data Bindings.
 
4. Now if you click on the hyperlink, it will take you to that page.


 <asp:hyperlinkfield datatextfield="LeadID" datanavigateurlfields="LeadID" datanavigateurlformatstring="LeadInformation.aspx?LeadID={0}" text="Lead ID" xmlns:asp="#unknown" />
 
Share this answer
 
Comments
Sehaj 1-Nov-13 22:46pm    
Thanks for the reply. But i have been trying this but it is not solving my purpose. I wanted that the hyperlinks' URL should be dyna,ically bound by the url path stored in the database.

That is, I have a databse sqlserver and i have stored a description and a corresponding url path.Now when the page loads , the hyperlinks' url in the grid view should be set to the url in the database.

If there are 10 such records, each hyperlink should be set to the path of individual record of the databse.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900