SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member vihugo's Avatar
    Join Date
    Mar 2009
    Location
    Düsseldorf, Germany
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool ASP.NET - Book [ Sitepoint ] - Error: Object reference not set to an instance of...

    Hi there,

    I've purchased "Build Your Own ASPdotNET 2.0 Web Site Using C# & VB, 2nd Edition" [ used ] and I was facing a certain wired difficulty last weekend. After following all the instructions of the samlpes of chapter 10 2nd Task, I have got the follwing error message after klicking the LinkButton which should leed me to the display of the EmployeeID, but threw me an exception saying:

    Object reference not set to an instance of an object.
    VS marks the line:

    li.Text = "Employee ID: <strong>" + e.CommandArgument + "</strong><br />";
    as the source of the error.

    Someone else had a similiar problem earlier here:

    Thread 173783

    , but I could not find out how this could help me .

    I've attached the complete source code for this part of the book, also a text version of the most important aspx and cs - files.

    Thank you soooo much in Advance!!!

    Cheers vihugo
    Attached Files Attached Files
    Everything which is only likely, is as likely as wrong. Descartes

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2009
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You must instantiate a new literal class.

    Replace this:
    Literal li;

    with this:
    Literal li = new Literal();
    iiicreative.com - Louisiana Web Design
    Innovation. Intuition. Imagination + Creative

    Follow me on twitter!

  3. #3
    SitePoint Member vihugo's Avatar
    Join Date
    Mar 2009
    Location
    Düsseldorf, Germany
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    Hi bholli,

    first of all THANKS for replying that fast.

    As allways: In most cases the problem sits between the keyboard and the seat .

    I've found a wired TYPO regarding the NAME of the object. It was "extraDetailslLiteral" and should be "extraDetailsLiteral". Would you have found it with one try? Anyway.

    And that's it. It was like the Error Message said, that the object does not exist, so the reference was of course null.

    Shame on me. But thanks anyway.

    Cheers vihugo
    Everything which is only likely, is as likely as wrong. Descartes


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •