Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 32463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T13:46:01+00:00 2026-05-10T13:46:01+00:00

I have a web site in asp.net that uses a master page. In this

  • 0

I have a web site in asp.net that uses a master page. In this master page I have a multiview control with one view that has all the content for the content pages and one view that has some local content to the master page where I show error messages from all content pages.

In this error view I have a asp.net Label control that displays the error messages. Usually the label works fine, but in some few cases the label is null, which renders a NullReferenceException. Now I have handled this case by checking if the label is null before using it, but still my question is:

Why is this label null? What are the circumstances that can generate this?

EDIT: In the master page I have a method called SetErrorText that takes a string and sets the label. I’m calling this method from the content pages’ Page_Load method, and this generally works fine. In all but two cases (that I’ve discovered so far) the label is initialised, and nothing separates these two cases from all the ones that work.

Also, all other controls in the master page are initialised, such as the View-control that houses the label.

When the Page_Load of a content page rolls around, the master page should be populated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T13:46:02+00:00Added an answer on May 10, 2026 at 1:46 pm

    It seems that the problem was one of sloppiness. Someone had forgotten to delete the auto-generated Content-controls that Visual Studio throws in on all content pages where the master page has a ContentPlaceHolder-control.

    If a content page has a Content-control, all controls that are placed in the ContentPlaceHolder-control on the master page will be null, it seems.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have website that uses ASP.net Membership Provider. This web site will be served
I have a web site that uses Membership and form authentication: ASP.NET Page: <asp:LoginView
I have an ASP.NET MVC 3 web site that uses Windows Authentication running under
I have an asp.net site that uses Bing Translate Web service(http://api.microsofttranslator.com/V2/Soap.svc) The code that
I have a simple ASP.Net 4.0 website that uses a master page that I
I have an existing Web Site that uses multiple ASP .Net Web Forms projects.
I have a website that uses basic ASP.Net forms authentication. In the web.config file
I have an Asp.Net 4.0 website/control interface that uses an update panel and some
So I have this ASP.Net 2.0 website that uses functions contained within a JS
I have clients that use our web site (asp.net) that they have to be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.