E
Eskimo
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?
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?