Hi Jonathan,
If you're using ASP.NET 2.0, you can use GridView instead of DataGrid
control since GridView is better.
As for adding hyperlink in DataGrid or GridView column, you can conside
either use the built-in LinkFied(column) or define a template column and
put your own html mark(include link) in it.
Here are some web articles that may help you:
#Hyperlink Columns in GridView Control
http://geekswithblogs.net/azamsharp/archive/2005/10/30/58551.aspx http://geekswithblogs.net/azamsharp/archive/2006/09/18/91514.aspx Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx. ==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
[quoted text, click to view] >From: "Jonathan" <none@none.com>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>Subject: How do I have datagrid hyperlinks?
>Date: Mon, 18 Feb 2008 23:26:48 +1300
\
>
>
>In the sample code below, how do I make the various text items in a
datagrid
>column have a clickable hyperlinks?
>
>e.g. Ford Mustang
>
>should be a link to
www.mysite.com/mustang.htm >
>
></head>
>
><%@ Page language="VB" Debug="true" %>
><%@ Import Namespace="System.Data" %>
><%@ Import Namespace="System.Data.OleDb" %>
>
><script language="VB" runat="server">
>
>Sub Page_Load(Sender as Object, E as EventArgs)
>
> Dim oConn As OleDbConnection
> Dim oComm As OleDbDataAdapter
> Dim sConn As String
> Dim sComm As String
> Dim oDataSet As New DataSet
>
> 'Build the connection string
> sConn = "Provider=Microsoft.Jet.OLEDB.4.0;"
> sConn += "Data Source=D:\inetpub\www\mysite\myaccessdb.mdb;"
> sConn += "Persist Security Info=False"
>
> 'Build the SQL string
> sComm = "SELECT qryDataGrid01.* "
> sComm += "FROM qryDataGrid01;"
>
> 'Create the connection and command objects
> oConn = New OleDbConnection(sConn)
> oComm = New OleDbDataAdapter(sComm, oConn)
>
> 'Fill the dataset with the results of the query
> oComm.Fill(oDataSet, "qryDataGrid01")
>
> 'Set the grid source to the dataset and bind the data
> oGrid.DataSource=oDataSet.Tables("qryDataGrid01").DefaultView
> oGrid.DataBind()
>
>End Sub
></script>
>
>
><asp:DataGrid runat="server" id="oGrid" BackColor="#eeeeee"
>HorizontalAlign="Left">
><HeaderStyle Font-Bold="True"/>
><AlternatingItemStyle BackColor="White" />
></asp:datagrid>
>
>
>
>