I have a "view" link to an aspx page in a gridview for each row.
Depending on the type of resource 1) File or 2) Hyperlink, it must either download the file or go to the mentioned hyperlink.
<asp:TemplateField HeaderText="View">
<ItemTemplate>
<a id="View" href="../resources/ResourceFile.aspx?Id=<%# Eval("Id")%>" target="_blank">View</a>
</ItemTemplate>
</asp:TemplateField>
I have earned for the file type, but how to redirect to an external link, for example, "www.yahoo.com", if it is a hyperlink.
In code <
if(resource.ResourceType.ToLower().Equals("hyperlink")){
}
EDIT: It is shown that the link must have the http: // prefix for it to work. Feeling stupid now :)
source
share