Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > IMG null reference <grr/>

Reply
Thread Tools

IMG null reference <grr/>

 
 
Eskimo
Guest
Posts: n/a
 
      03-10-2005
My web control has a repeater in it,
in the header it has an IMG with an ID
why do I get the following?

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:


Line 226:
Line 227: if (strSortDirection == "ASC")
Line 228: courseTitleimg.Src="../../images/arrow_up.gif";
Line 229: else
Line 230: courseTitleimg.Src="../../images/arrow_down.gif";


the control (ascx):
....
<asp:Repeater id="CoursesRepeater" runat="server">
<HeaderTemplate>
<table id="tblCourses" class="" cellspacing="4" cellpadding="4"
width="100%">
<tr style="background-color:#E0E0E0">
<td>
<asp:CheckBox ID="CheckAll" OnClick="javascript:
return select_deselectAll (this.checked, this.id);"
text="courseId" runat="server" /></td>
<td>
<asp:LinkButton ID="LinkButton1" Runat="server"
OnClick="SortCourseTitle">Courses</asp:LinkButton><IMG id="courseTitleimg"
src="../../images/arrow_up.gif" runat="server"/></td>
<td>
<asp:LinkButton ID="Linkbutton2" Runat="server"
OnClick="SortLiveDate">Live</asp:LinkButton><IMG id="liveDtimg"
src="../../images/arrow_up.gif" runat="server"/></td>
<td>
<asp:LinkButton ID="Linkbutton3" Runat="server"
OnClick="SortUpdateDate">Updated</asp:LinkButton><IMG id="updateDtimg"
src="../../images/arrow_up.gif" runat="server"/></td>
</tr>
</HeaderTemplate>
....

the control code behind (ascx.cs):

....

protected System.Web.UI.HtmlControls.HtmlImage courseTitleimg;
protected System.Web.UI.HtmlControls.HtmlImage liveDtimg;
protected System.Web.UI.HtmlControls.HtmlImage updateDtimg;

....
the code snippet in the error is trying to set the IMG src attribute to
nothing, or the arrow_up.gif or the arrow_down.gif.

any ideas or clues?

--
tym, Eskimo
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
putting img above/bellow img ? Jopek HTML 7 04-26-2009 10:26 PM
how to replace this like <img width=100 ...> with <img width="100" ...> zhanye815@gmail.com Perl Misc 7 06-21-2006 11:16 PM
"stringObj == null" vs "stringObj.equals(null)", for null check?? qazmlp1209@rediffmail.com Java 5 03-29-2006 10:37 PM
Problem: <img></img> Philipp Lenssen XML 15 07-03-2005 09:23 AM
how to download img from html img tag news.austin.rr.com ASP .Net 2 04-27-2005 06:25 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57