Making hyperlinks active in GridView of database results
Assuming that you have a database containing records having a field with entries
of the type: www.someplace.com, and that you would like those fields to be
clickable hyperlinks, here is what to do.
The starting point for this tutorial is that you have already made an aspx page
that displays GridView results from a database, and the displayed records have a
column having the title "website", which shows fields as plain text of the form
www.someplace.com. To make those addresses working hyperlinks:
1. Click on the expander arrow in the upper right corner of the GridView and
choose Add New Column
2. Choose a Field of Type: Hyperlink field from the drop down menu
3. For Header Text, enter a sensible name for the column, for example "Links"
4. Choose the "Get text from data field" and select the "website" field from the
drop down list. Leave the Text format string box blank.
5. For the Hyperlink URL, check the box "Get URL from data field" and choose the
field "website" from the drop-down list
6. For the URL format string, type: http://{0} Note: this causes the data from
the website field to replace the placeholder {0}
7. Click OK, Save, preview in browser, and you should find the Links colum
contains working hyperlinks.
The only problem is that you also still have the Website column (complete with
non-functional web addresses) showing. To remove this column from the GridView,
highlight it in GridView, click the expander arrow, and choose remove column.
Save your work and you are done.