Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying an image in a gridview from an ObjectData Source created by a list(of T) in asp.net using vb
    primarykey
    data
    text
    <p>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.</p> <p>Here is my code:</p> <pre><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=" &amp; AutoDealerID _AutoDealer.CompanyName = _Reader(1) _AutoDealer.Address = _Reader(2) &amp; ", " &amp; _Reader(3) &amp; "." _AutoDealer.ContactDetails = "Phone: " &amp; _Reader(5) &amp; vbCrLf &amp; " or email: " &amp; _Reader(4) results.Add(_AutoDealer) End While Connection.Close() _Reader.Close() Return (results) End Function </code></pre> <p>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=" &amp; AuctionID line. I've tried various ways of getting around this but the image is still not displaying in the gridview.</p> <p>Any advice would be apprecriated. Thanks in advance </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload