Hi,
Try like this.
Protected Sub GridView1_RowDataBound(ByV
If e.Row.RowType = DataControlRowType.DataRow
if Convert.ToString(e.Row.Cel
Dim htmlAnc As New HtmlAnchor
htmlAnc.HRef = "http://www.google.com?Sea
htmlAnc.InnerHtml = "<b>" & Convert.ToString(e.Row.Cel
e.Row.Cells(0).Controls.Ad
End If
End If
End Sub
Change the cell column "cells(0)" as required.
Main Topics
Browse All Topics





by: madhevan_pillaiPosted on 2006-12-27 at 20:23:13ID: 18206325
Hi,
">
g") ); g")); g"));
Try this.
aspx part
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<a href= '<%# Eval("Link") %>' runat ="server" id="ref"> <%# Eval("Link")%> </a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("Name")%> '></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="No">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("No")%> '></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Codebehind.
protected void Page_Load(object sender, EventArgs e)
{
this.GridView2.DataSource = DataSource();
this.GridView2.DataBind();
}
private DataView DataSource()
{
DataTable dt = new DataTable();
dt.Columns.Add("Link", Type.GetType("System.Strin
dt.Columns.Add("Name", Type.GetType("System.Strin
dt.Columns.Add("No", Type.GetType("System.Strin
dt.Rows.Add(new object[] { "http://www.rediff.com", "Sam", 1 });
dt.Rows.Add(new object[] { "http://www.yahoo.com", "Rum", 2 });
dt.Rows.Add(new object[] { "http://www.msn.com", "Drum", 3 });
return dt.DefaultView;
}