JT_SIRO
asked on
Put Link in dynamic .Net Gridview
I'm trying to populate a grid with a list of files that are in a folder. I'm able to do that fine, but can't figure out how to pass a hyper link into my gridview. It keeps coming out literally.
Code attached. Here's the line that I need to change:
row["Link"] = "<a href=metadata.aspx?file=" + fi.Name + ">Add Track Info</a>";
Code attached. Here's the line that I need to change:
row["Link"] = "<a href=metadata.aspx?file=" + fi.Name + ">Add Track Info</a>";
// Detect the user, then check their folder for new tracks
DirectoryInfo di = new DirectoryInfo("C:\\FTP\\Catalog_DropFolder\\" + Profile.UserName);
FileInfo[] rgFiles = di.GetFiles("*.wav");
foreach(FileInfo fi in rgFiles)
{
row = dtFiles.NewRow();
row["FileName"] = fi.Name;
row["Link"] = "<a href=metadata.aspx?file=" + fi.Name + ">Add Track Info</a>";
dtFiles.Rows.Add(row);
}
ASKER
That worked! Thanks.
Can you tell me why that works? Is it because the Eval function renders HTML?
Can you tell me why that works? Is it because the Eval function renders HTML?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<asp:TemplateField>
<ItemTemplate><%# Eval("Link") %></ItemTemplate>
</asp:TemplateField>