Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2260
  • Last Modified:

ImageField in Gridview ASP.net 2.0

I would like an external target URL to be assigned to this field when it autopopulates. However, I can't find a field option for this inside gridview -> edit columns, etc. Any suggestions.
0
jumpstart0321
Asked:
jumpstart0321
1 Solution
 
MikeMCSDCommented:
You need a  TemplateField. Try this:


    <asp:TemplateField>
      <ItemTemplate>
        <asp:HyperLink Target="_blank"  runat="server" ID="link" NavigateUrl='<%# "../CatalogAdmin.aspx?DepartmentID=" + Request.QueryString["DepartmentID"] + "&amp;CategoryID=" + Eval("CategoryID")%>' Text="View Products">
<img src='ProductImages/<%# Eval("Image1FileName") %>' />
        </asp:HyperLink>
      </ItemTemplate>
    </asp:TemplateField>

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now