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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T04:43:26+00:00 2026-05-30T04:43:26+00:00

I want to display image in img control. Asp code: <asp:Image id=id src='<%# Eval(Item.SmallPicPath)

  • 0

I want to display image in img control.

Asp code:

<asp:Image id="id" src='<%# Eval("Item.SmallPicPath") %>' Runat="Server" >

C# code:

      public void Page_Load(Object sender, EventArgs e) 
{ 
   Glasses item=GetItemByID(GlassesID)    //retrive record from data base
} 

Glasses is a class that have property SmallPicPath.

I try to display image but i get error any idea how to fix it?

Thank you in advance!

  • 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-30T04:43:27+00:00Added an answer on May 30, 2026 at 4:43 am

    The approach you’re trying to use is based on databinding, which generally isn’t good for a single image.

    Instead, try something like this markup:

    <asp:Image id="MyImageId" runat="server">
    

    Then, in your code behind:

    public void Page_Load(Object sender, EventArgs e) 
    { 
        Glasses item = GetItemByID(GlassesID);    //retrive record from data base
        this.MyImageId.ImageUrl = item.SmallPicPath;
    }
    

    If you still want to use databinding for some reason, something like this should work (although there’s a performance cost compared to the other approach):

    <asp:Image id="MyImageId" runat="server" ImageUrl="<%# item.SmallPicPath %>">
    

    Code-behind:

    public Glasses item;
    
    public void Page_Load(Object sender, EventArgs e) 
    { 
        this.item = GetItemByID(GlassesID);    //retrive record from data base
        this.MyImageId.DataBind();
    }
    

    Databinding is an optional operation; you need to call DataBind() on the control (or its parent) to make it happen.

    You only need “Eval()” in cases that involve a data container (usually via a DataSource) — which this one doesn’t.

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

Sidebar

Related Questions

If I want to display an image in my webpage and its src is
i want to display image at browser with help of given code images.jsp <%@
I want to display an image if 2 conditions are met. The data item
Let there is a (display:inline) image on a white background: <a href=#><img src=...></a> Then
Say I have an image like this: <img src=someimage.png alt=Image /> I want to
I want to display image using base64 encoding in IE using GWT If it
I want to display an image within a scroll area. The view port of
I want to display an image at 'true size' in my application. For that
I want to display .jpg image in an Qt UI. I checked it online
I want to display a thumbnail image in a cell of tableViewController , this

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.