-1

I have LinkButton in grid view

<asp:TemplateField HeaderText="Images">
       <ItemTemplate>
          <asp:LinkButton ID="lnkDrvImgLic" CommandArgument='<%# Eval("intVou") %>' CommandName="viewLicImg" runat="server">Licence Image</asp:LinkButton>
       </ItemTemplate>
    </asp:TemplateField>

<%#Eval("intVou") %> is Primary key and it should show the image from database based on primary key. Does it requires any parameter for server path? It would be fine if I can open image in new tab.

Brijesh
  • 91
  • 1
  • 14

1 Answers1

0

Or you can instead use the Hyperlink control like this:

<asp:HyperLink  NavigateUrl='<%# String.Concat("~/",Eval("ImagePathField")) %>' Target="_blank" runat="server" >L</asp:HyperLink>

Notice that you must use "~/" to get the relative path for the image. Also you need to add Target"_blank" to open the image in new tab.

Hope this helps.

jack
  • 1,103
  • 2
  • 10
  • 18