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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:20:20+00:00 2026-05-25T00:20:20+00:00

I’m having a problem displaying an image from an ObjectData Source created by function

  • 0

I’m having a problem displaying an image from an ObjectData Source created by function which adds iems to a list(of T) class. The ObjectData Source then becomes the gridviews Data Soource. All the other fields are displaying, except the image.

Here is my code:

Public Class AutoDealer

Private mLogo As ImageButton
Private mComapnyName As String
Private mAddress As String
Private mContactDetails As String

Public Sub New()

End Sub

Public Sub New(ByVal Logo As ImageButton, ByVal CompanyName As String, ByVal Address As String, ByVal ContactDetails As String)
    mLogo = Logo
    mComapnyName = CompanyName
    mAddress = Address
    mContactDetails = ContactDetails
End Sub

Public Property Logo As ImageButton
    Get
        Return mLogo
    End Get
    Set(ByVal value As ImageButton)
        mLogo = value
    End Set
End Property

Public Property CompanyName As String
    Get
        Return mComapnyName
    End Get
    Set(ByVal value As String)
        mComapnyName = value
    End Set
End Property

Public Property Address As String
    Get
        Return mAddress
    End Get
    Set(ByVal value As String)
        mAddress = value
    End Set
End Property

Public Property ContactDetails As String
    Get
        Return mContactDetails
    End Get
    Set(ByVal value As String)
        mContactDetails = value
    End Set
End Property

Public Class DisplayAutodealers
Public Shared Function GetAutodealers() As List(Of AutoDealer)
    Dim Connection As SqlConnection = New SqlConnection(...)
    Dim Command As SqlCommand = New SqlCommand()
    Dim _Reader As SqlDataReader

    Command.Connection = Connection
    Command.CommandText = "Select ID, Company_Name, Physical_Address, Area_Code, Email_Address, Contact_Number from AutoDealer_Account"
    Connection.Open()
    _Reader = Command.ExecuteReader

    Dim results As New List(Of AutoDealer)
    While _Reader.Read()
        Dim _AutoDealer As New AutoDealer
        Dim AutoDealerID As Integer

        AutoDealerID = _Reader(0)

        _AutoDealer.Logo.ImageUrl = "GetAutoDealerLogo.aspx?ID=" & AutoDealerID
        _AutoDealer.CompanyName = _Reader(1)
        _AutoDealer.Address = _Reader(2) & ", " & _Reader(3) & "."
        _AutoDealer.ContactDetails = "Phone: " & _Reader(5) & vbCrLf & " or email: " & _Reader(4)

        results.Add(_AutoDealer)
    End While
    Connection.Close()
    _Reader.Close()

    Return (results)

End Function

My code in my image rendering page (“GetAutoDealerLogo.aspx”) is working. I’ve tested it by displaying images on other pages. This code at the moment is getting a NullReferenceException on the CarImage.ImageUrl = “GetAuctionPageImage.aspx?ID=” & AuctionID line. I’ve tried various ways of getting around this but the image is still not displaying in the gridview.

Any advice would be apprecriated.
Thanks 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-25T00:20:20+00:00Added an answer on May 25, 2026 at 12:20 am

    I think you’d be better off using the Repeater control. That way, you can define the controls and the layout of each record in the bound data source. For your issue, you can add an ASP.NET Image control and bind to that. I was just messing around with the Repeater control for the first time, and I am binding to a List(Of ) in the same way, and it’s a breeze to bind the data, control the layout, etc.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I have a text area in my form which accepts all possible characters from
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a bunch of posts stored in text files formatted in yaml/textile (from
Does anyone know how can I replace this 2 symbol below from the string

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.