Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6352533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:13:24+00:00 2026-05-24T22:13:24+00:00

I have a database and I’m storing images in it along with a person’s

  • 0

I have a database and I’m storing images in it along with a person’s name, and other attributes. I’ve databound my listview with a stored procedure. I want to know how I can display an icon on a row depending on if the record for that row has a picture or not for the person…

I’m not sure how to accomplish this however with the templates in asp.net

If you need me to provide any additional info I can.

Thanks.

EDIT:

Here is my template and the s where I’m hoping to put them.

<ItemTemplate>
    <tr style="">
        <td class="width100">
            <asp:Image ID="Image1" runat="server" ImageUrl="./Images/PlayerPictures/nothing.gif" title="Picture Available" CssClass="icon right" />
            <asp:Image ID="Image2" runat="server" ImageUrl="./Images/PlayerPictures/nothing.gif" title="Charts Available" CssClass="icon right" />
            <asp:Image ID="Image3" runat="server" ImageUrl="./Images/PlayerPictures/nothing.gif" title="Reports Available" CssClass="icon right" />
            <asp:Image ID="Image4" runat="server" ImageUrl="./Images/PlayerPictures/nothing.gif" title="Video Available" CssClass="icon right" />
        </td>
        <td class="width350">
                <a href="?team=<%# TeamNumber() %>&player=<%# Eval("PlayerKey") %>"><asp:Label ID="PlayerLabel" runat="server" Text='<%# Eval("Player") %>' /></a>
        </td>
        <td>
            <asp:Label ID="PositionLabel" runat="server" Text='<%# Eval("Position") %>' />
        </td>
    </tr>
</ItemTemplate>

I have no code-behind that is relevant I don’t think because the Listview is databound like so…

<asp:ListView ID="ListView4" runat="server" 
                                    DataSourceID="ListViewPlayersWithFilter"
                                    DataKeyNames="PlayerKey">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T22:13:26+00:00Added an answer on May 24, 2026 at 10:13 pm

    You can use ListView.ItemDataBound Event to display an image based on the column value:

    Aspx:

    <ItemTemplate>
                <tr style="">
                    <td class="width100">
                        <asp:Literal ID="lblPic" runat="server" />
                        ...
                        ...
                    </td>
                    <td class="width350">
                            <a href="?team=<%# TeamNumber() %>&player=<%# Eval("PlayerKey") %>"><asp:Label ID="PlayerLabel" runat="server" Text='<%# Eval("Player") %>' /></a>
                    </td>
                    <td>
                        <asp:Label ID="PositionLabel" runat="server" Text='<%# Eval("Position") %>' />
                    </td>
                </tr>
            </ItemTemplate>
    

    Code Behind:

    Protected Sub ListView1_ItemDataBound(ByVal sender As Object, ByVal e As ListViewItemEventArgs)
        If e.Item.ItemType = ListViewItemType.DataItem Then
            Dim lblPic As Literal = CType(e.Item.FindControl("lblPic"), Literal)
            Dim rowView As System.Data.DataRowView
            rowView = CType(e.Item.DataItem, System.Data.DataRowView)
    
            If Convert.IsDbNull(rowView("hasPic") = true then
                lblPic.Text = "<img src=\"/Images/PlayerPictures/nothing.gif\" alt=\"Picture Available\" CssClass=\"icon right\" />"
            Else
                lblPic.Text = "<img/> tag to Display Pic"
            End If      
        End If
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have database where data is stored along timestamp entries, that are keys. i
I have database application, I want to allow the user to restore the deleted
I have database table with the names of businesses and want to take advantage
I have database with a column name State/Province. All the queries and data transfers
I have database in which data is imported from the other table. if data
I have database dump and I want load it to sqlite database on iphone
I have database project in visual studio 2010. It has tables views stored procedures
I have database table but without the index, and I want to add index
I have database with following columns: id, parent, name, description The id has been
I have database with images on it example: i have 5 of clothes images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.