【发布时间】:2011-10-04 13:59:11
【问题描述】:
引发了“System.Web.HttpUnhandledException”类型的异常。
Step into: Stepping over non-user code 'System.Web.UI.Control.OnLoad'
Step into: Stepping over non-user code 'System.Web.UI.Control.LoadRecursive'
Step into: Stepping over non-user code 'System.Web.UI.Control.LoadRecursive'
Step into: Stepping over non-user code 'System.Web.UI.Control.LoadRecursive'
Step into: Stepping over non-user code 'System.Web.UI.Page.ProcessRequestMain'
Step into: Stepping over non-user code 'System.Web.UI.Page.ProcessRequest'
Step into: Stepping over non-user code 'System.Web.UI.Page.ProcessRequest'
Step into: Stepping over non-user code 'System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute'
Step into: Stepping over non-user code 'System.Web.HttpApplication.ExecuteStep'
A first chance exception of type 'System.NullReferenceException' occurred in App_Code.2x2ldwnl.dll
A first chance exception of type 'System.Exception' occurred in App_Code.2x2ldwnl.dll
A first chance exception of type 'System.ServiceModel.CommunicationException' occurred in mscorlib.dll
A first chance exception of type 'System.NullReferenceException' occurred in App_Code.2x2ldwnl.dll
A first chance exception of type 'System.Exception' occurred in App_Code.2x2ldwnl.dll
我的用户控件在构建它自己的东西时也可以正常编译,但在我运行调试演练时会崩溃。 有什么想法可能导致这种情况吗?
用户控制代码:
Call Function
protected void DisplaySendMessageQuestion(string title, int messageType)
{
UCResetPasswordDisplay.SetVisible(true);
UCResetPasswordDisplay.MessageType = messageType.ToString();
UCResetPasswordDisplay.Title = title;
}
用户控件 aspx.cs
public partial class UserControls__ResetPasswordPopup : System.Web.UI.UserControl
{
public event EventHandler YesResetClick;
public event EventHandler NoResetClick;
protected void Page_Load(object sender, EventArgs e)
{
PnlAddConfirmation.CssClass = "PanelResetPass";
PnlAddConfirmation.CssClass = "PanelYesNoCore";
txtUsername.Focus();
}
public string MessageType
{
get { return this.lblMessageType.Text; }
set { this.lblMessageType.Text = value; }
}
public string UserData
{
get { return this.txtUsername.Text; }
set { this.txtUsername.Text = value; }
}
public string Title
{
get { return this.lblEventTitle.Text; }
set { this.lblEventTitle.Text = value; }
}
public bool IsVisible
{
get { return this.PnlAddConfirmation.Visible; }
set { this.PnlAddConfirmation.Visible = value; }
}
public string ErrorMessage
{
get { return this.LblEventNotification.Text; }
set { this.LblEventNotification.Text = value; }
}
public void SetVisible(bool Visible)
{
PnlAddConfirmation.Visible = Visible;
// PnlScreenCover.Visible = Visible;
}
protected void ChangePasswordButton_Click(object sender, EventArgs e)
{
if (YesResetClick != null)
{
YesResetClick(this, EventArgs.Empty);
}
}
protected void ImgBtnCancel_Click(object sender, EventArgs e)
{
if (NoResetClick != null)
{
NoResetClick(this, EventArgs.Empty);
}
}
}
【问题讨论】:
-
发布代码会有所帮助。请问您是在页面生命周期的哪个阶段添加控件的?
-
您的用户控件中有什么?似乎 Usercontrol 的内容导致错误
-
编译器只会捕获编译时错误,不会捕获运行时错误。
-
Bump 添加了代码,我要做的就是将输入从一个文本框返回到调用用户控件的页面,但我什至无法加载用户控件。