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 8564547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:13:30+00:00 2026-06-11T17:13:30+00:00

I am using a listview to display a list of all the users of

  • 0

I am using a listview to display a list of all the users of my site. A user can upload multiple images, so when i generated my model with entity framework, 2 entities were created: Users and Images. User had a navigation property to a collection of images and Images had a navigation property to a single user.

I am now trying to display in my listview 1 of the images uploaded by the user (if he has uploaded any).It doesn’t matter which one is being displayed.

I created an EntityDataSource, and i’ve added “Images” into it’s include property. Then, i branched my listview to the datasource. usually, to display the content of the navigation property, i use something like

<asp:Label ID="fn" runat="server" Text='<%# Eval("Users.Firstname") %>' />

However, since it’s column of a collection that i’m trying to display,can i use something like this? IF so, what would be a propper way to manage the case where the user didn’t upload any image?

<asp:image ID="img" runat="server" ImageUrl='<%# Eval("Images[0].path") %>' AlternateText="" />

  • 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-06-11T17:13:31+00:00Added an answer on June 11, 2026 at 5:13 pm

    Eval is using reflection and it has its limitations on more complicated terms. You should not be afraid of direct casting:

     <asp:image ID="img" runat="server" 
      ImageUrl='<%# ((YourObjectType)Container.DataItem).Images[0].path") %>' 
      AlternateText="" />
    

    Note that in order to cast to YourObjectType you will probably have to add an <@Import > directive to the page (or alternatively use a full type name, including the namespace).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Image list assigned to a listview to display transparent images. There
I am using listview to display three textviews(values for these text views where come
I have a ListView which is using a GridView to display a DataTable and
In past, I am using Listview and using below code can show a particular
I am using listview to display data, inside listview i am using image in
I have a custom subclass of AlertDialog that should display a list of all
I am trying to display all running apps on my android in a list
I am using AlertDialog with setMultiChoiceItems to let the user select multiple items which
I have an app using a ListView as a main screen. Each row displays
I am using ListView/DataPager. For performance reasons I page my results at database, using

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.