R – Turning information from a datasource into links

asp.netdatabasehyperlinkoracleweb-applications

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" >

Best Answer

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.