A
Anne Butera
Hello,
I am trying to set an image visible field to False if the dataset is null.
With the code below, I am getting an error - "Object reference not set to an
instance of an object."
First - the code behind:
Protected Sub Image1_DataBinding(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim storePic As New Image
storePic = dlNewsItems.FindControl("image1")
If storePic.ImageUrl = "" Then
storePic.Visible = False
Else
End If
End Sub
And the Datalist:
<aspataList ID="dlNewsItems" runat="server" DataSourceID="sqlNewsTable" ">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#
Eval("newsPicUrl", "{0}") %>'
OnDataBinding="Image1_DataBinding"/>
</ItemTemplate>
</aspataList>
Any help is appreciated.
Thank you,
Anne
I am trying to set an image visible field to False if the dataset is null.
With the code below, I am getting an error - "Object reference not set to an
instance of an object."
First - the code behind:
Protected Sub Image1_DataBinding(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim storePic As New Image
storePic = dlNewsItems.FindControl("image1")
If storePic.ImageUrl = "" Then
storePic.Visible = False
Else
End If
End Sub
And the Datalist:
<aspataList ID="dlNewsItems" runat="server" DataSourceID="sqlNewsTable" ">
<asp:Image ID="Image1" runat="server" ImageUrl='<%#
Eval("newsPicUrl", "{0}") %>'
OnDataBinding="Image1_DataBinding"/>
</ItemTemplate>
</aspataList>
Any help is appreciated.
Thank you,
Anne