Intellisense bug ?

Discussion in 'ASP .Net' started by GD, May 18, 2004.

  1. GD

    GD Guest

    I have a situation where I have renamed a HTML Label from "Label1" to
    "lblResult2 in an aspx page.
    However when I write code in the code behind module the control name
    "Label1" still appears in the intellisense list and I get the error
    "System.NullReferenceException: Object reference not set to an instance of
    an object." when I try to access the properties of the lblResults control.

    I've searched through MSDN for a solution/bugfix for this without any luck..

    Anyone had this before ??


    GD, May 18, 2004
    1. Advertisements

  2. Make sure your .aspx side has the id="lblResults" and runat="server"

    Then look at the field definitions inside you class.

    you should see one that says

    protected Label lblResults;

    Let me know if that doesn't solve your problem.

    (it isn't an intellisense bug)
    William F. Robertson, Jr., May 18, 2004
    1. Advertisements

  3. GD

    GD Guest

    In the definitions I have;

    Protected Withevents lblResults As System.Web.UI.WebControls.Label

    This occurs directly after the empty "InitialiseComponent" Sub and before
    the line - Private designerplaceholderDeclaration as System.Object

    There were two other declarations there for controls that had been deleted
    (manually from the HTML source)

    The line causing the error is a debug line in the code-behind module -

    Response.Write("Label Value is - " & Me.lblResults.Text)

    If I remove that line, then the same error occurs on - Me.lblResults.Text =

    Thanks for your help

    GD, May 18, 2004
  4. GD

    Mythran Guest

    Double-check the html for this label. Also, you said it was an html label, make
    sure that it has runat="server" attribute associated with it as well. And double
    check the id of the html label in the html portion.

    Mythran, May 18, 2004
  5. I have a situation where I have renamed a HTML Label from "Label1" to
    Just a thought, but did you make the change in the HTML view or the
    Design view? If you made the change in the HTML view, go to the Design
    view. I've had to do this to get the Code-Behind to update the member
    variable name properly...



    Scott Mitchell

    * When you think ASP, think!
    Scott Mitchell [MVP], May 19, 2004
  6. GD

    GD Guest

    Problem sorted ... thank you

    GD, May 19, 2004
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.