[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Can I put an image in a HyperLinkField?

I have a gridview like this:

                <asp:GridView ID="PatientList1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="PDAGetPatientList" AllowSorting="True" >
           <Columns>

                <asp:BoundField DataField="fldLastName" HeaderText="Last Name" SortExpression="fldLastName" />

                <asp:BoundField DataField="fldFirstName" HeaderText="First Name" SortExpression="fldFirstName" />

                <asp:HyperLinkField DataNavigateUrlFields="fldID" DataNavigateUrlFormatString="Details.aspx?ID={0}"
                    DataTextField="fldID" HeaderText="ID" SortExpression="fldID" />
               
                <asp:HyperLinkField
                    DataNavigateUrlFields="fldID"
                    DataNavigateUrlFormatString="~/Results.aspx?id={0}"
                    Text="Labs" />

            </Columns>

        </asp:GridView>

I want my second hyperlink to be an image rather than text. How do I do this? A HyperLinkField doesn't appear to have an image property.

Colin
0
cjmackenzie
Asked:
cjmackenzie
1 Solution
 
mirmansoorCommented:
In the text property try writing an img tag and check.. i think it should work

HeaderText =<img src="yourimg.jpg" />

0
 
cjmackenzieAuthor Commented:
Thank-you. Seems obvious now. Thanks for the prompt answer.

Colin
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

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