I get this error message when I try to run my ASP.NET application on my client's server. It works fine on my PC and I get no errors when I run it in debug mode. Please help!
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Payroll_Application.NewRecord.ApplyTemplate(Object sender, EventArgs e)
Payroll_Application.NewRecord.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
I've copied the necessary snippets of code below.
<asp:dropdownlist id="ddlDebtType" AutoPostBack="True" Runat="server" OnSelectedIndexChanged="ApplyTemplate"></asp:dropdownlist>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ddlDebtType.Items.Add("Loan"
ddlDebtType.Items.Add("Advance"
ddlDebtType.Items.Add("Prepay"
ddlDebtType.Items.Add("Mutual"
End Sub
Public Sub ApplyTemplate(ByVal sender As System.Object, ByVal e As System.EventArgs)
'all code in this sub has been commented out for debugging purposes, but I still get the error
End Sub
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Payroll_Application.NewRecord.ApplyTemplate(Object sender, EventArgs e)
Payroll_Application.NewRecord.Page_Load(Object sender, EventArgs e)
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
I've copied the necessary snippets of code below.
<asp:dropdownlist id="ddlDebtType" AutoPostBack="True" Runat="server" OnSelectedIndexChanged="ApplyTemplate"></asp:dropdownlist>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ddlDebtType.Items.Add("Loan"
ddlDebtType.Items.Add("Advance"
ddlDebtType.Items.Add("Prepay"
ddlDebtType.Items.Add("Mutual"
End Sub
Public Sub ApplyTemplate(ByVal sender As System.Object, ByVal e As System.EventArgs)
'all code in this sub has been commented out for debugging purposes, but I still get the error
End Sub