0
votes

I have a web application where I am getting data from an oracle database in a gridview.

Can anyone tell me how to turn this data into links to other pages on my web application?

For example, if I am getting data about a list of objects that have their own ID, I want to be able to click the ID and go to a page with information on only that object

This is all the code for my gridview, in SystemGrid_Sorting, I get all the info from the databse, so I can't actually define the properties of my columns.

Thanks in advance

asp:GridView ID="SystemGrid" runat="server" AllowSorting="True" Width="232px" OnSorting="SystemGrid_Sorting" >

2

2 Answers

0
votes

This is very easy:

<asp:HyperLinkField DataNavigateUrlFields="ID"
 DataNavigateUrlFormatString="DetailPage.aspx?id={0}"
                    DataTextField="CategoryName" NavigateUrl="DetailPage.aspx" />

Now just set up DetailPage.aspx to call into the database using the ID in the querystring and display whatever you like.

0
votes

Essentially, given an ID 1234 you need to turn it into an HTML link like:

<a href="mydomain/myapp/mypage?id=1234">1234</a>

I don't know whether your gridview tool has a built-in method for constructing such links for you?