IMG null reference <grr/>

Discussion in 'ASP .Net Web Controls' started by Eskimo, Mar 10, 2005.

  1. Eskimo

    Eskimo Guest

    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
     
    Eskimo, Mar 10, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Natty Gur

    Re: Grr Tables and postbacks

    Natty Gur, Jul 15, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    397
    Jason
    Jul 16, 2003
  2. news.austin.rr.com

    how to download img from html img tag

    news.austin.rr.com, Apr 27, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    544
    Steve C. Orr [MVP, MCSD]
    Apr 27, 2005
  3. Mark Rae

    <br /> grr!!!

    Mark Rae, Apr 11, 2006, in forum: ASP .Net
    Replies:
    9
    Views:
    604
    Kevin Spencer
    Apr 22, 2006
  4. grahamo

    grr... this old nut

    grahamo, Jul 13, 2004, in forum: C++
    Replies:
    37
    Views:
    993
    Bob Hairgrove
    Aug 7, 2004
  5. Replies:
    4
    Views:
    512
    Oliver Wong
    Aug 1, 2006
Loading...

Share This Page