Reputation: 4233
Any way to do this? I need standard link:
I tryed hyperlink and url datatypes, and it won't accept this format.
I need to display it in aspxgridview as column with links.
I tryed storing html tag as string, and it doesnt work in aspxgridview.
T1.Columns.Add("edit", typeof(Hyperlink));
for (int i = 0; i < T1.Rows.Count; i++)
{
T1.Rows[i][6] =
"<a href=\"~/editprofile.aspx?id=" + T1.Rows[i].ItemArray[0].ToString() + "\" >Edit</a>";
}
There's code, basically, Im calling edit page, passing id of user.
Upvotes: 0
Views: 1768
Reputation: 20364
You don't store the hyperlink, you store the hyperlink's href value, e.g. the raw URL.
To display in a GridView Column
, just use the <asp:TemplateField><ItemTemplate>
control rather than a Bound Template, e.g.
<asp:TemplateField>
<ItemTemplate>
<a href='<%#Eval("LinkText")%>'><%#Eval("LinkName")%></a>
</ItemTemplate>
</asp:TemplateField>
Upvotes: 2