Hi finestkatch4u,
Use string.Format in the NavigateUrl to specify the main domain.
HTML
<asp:GridView ID="gvCustomer" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Url">
<ItemTemplate>
<asp:HyperLink runat="server" CssClass="LinkNauha" Target="_blank" ID="link"
Text='<%# Eval("title") %>' NavigateUrl='<%# string.Format("http://mywebsite.com{0}", Eval("url")) %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Namespace
C#
using System.Data;
VB.Net
using System.Data;
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[2] {
new DataColumn("title"),
new DataColumn("Url")});
dt.Rows.Add("hello", "/myfolder/youfolder/hello.mp3");
gvCustomer.DataSource = dt;
gvCustomer.DataBind();
}
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim dt As DataTable = New DataTable()
dt.Columns.AddRange(New DataColumn(1) {New DataColumn("title"), New DataColumn("Url")})
dt.Rows.Add("hello", "/myfolder/youfolder/hello.mp3")
gvCustomer.DataSource = dt
gvCustomer.DataBind()
End If
End Sub
Screenshot