Me aparece un error extraño. Tengo el siguiente código de front-end:¿Por qué obtengo esta System.NullReferenceException?
<%@ Page Title="" Language="C#" MasterPageFile="~/nokernok/MasterPages/nokernok.Master" AutoEventWireup="true" CodeBehind="articleList.aspx.cs" Inherits="development.nokernok.articleList" %>
<%@ Register TagPrefix="EPiServer" Namespace="EPiServer.WebControls" Assembly="EPiServer" %>
<asp:Content ID="Content2" ContentPlaceHolderID="LeftContentPlaceHolder" runat="server">
<asp:Label ID="lblTest" runat="server" />
</asp:Content>
Y tengo el siguiente código de fondo: archivo
using System;
using System.Web;
using EPiServer;
using EPiServer.Core;
using development.NaafLibrary;
namespace development.nokernok
{
public partial class articleList : TemplatePage
{
protected void Page_Load(object sender, EventArgs e)
{
lblTest.Text = "TEEEEEEEEEEEST";
}
}
}
diseñador:
namespace development.nokernok {
public partial class articleList {
protected global::System.Web.UI.WebControls.Label lblTest;
}
}
Y me da mensaje de error thiss:
Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
development.nokernok.articleList.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\naaf\nokernok\articleList.aspx.cs:17
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Tengo otro te mplates que funciona bien. Simplemente no puedo entender por qué estoy recibiendo este error aquí.
Actualización 1:
que acaba de añadir algo más de código.
parece buena la muestra que ha dado, ¿puede darnos un fragmento más detallado? ¿está habilitado su ViewState? – hallie
Active el rastreo para su página y vea qué y cuándo sucede. –
Hallie: ¿Frontend o backend? ¿Y cómo puedo verificar si mi ViewState está habilitado? Henk: Estoy usando Visual Web Developer 2008 Express Edition. No he podido activar el rastreo. Si me pueden ayudar con eso, ¡me sentiría extremadamente feliz! – Steven