Sep 07, 2012, 8:25 AM
Null Reference Exception in MVC
Hi, I try to load a partial MVC view when I press a button.
the Button Code is here
I have no idea where to look for the problem.
any hints?
thanks
the Button Code is here
<ext:Button ID="b1" runat="server" Icon="Accept" Text="Button1" IconAlign="Left"
Cls="btnLeft">
<DirectEvents>
<Click Url="/Shared/ContractForm" >
<ExtraParams>
<ext:Parameter Name="containerId" Value="App.Panel2" Mode="Value" />
</ExtraParams>
</Click>
</DirectEvents>
</ext:Button>
the Controller Code is here public ActionResult ContractForm(string containerId)
{
Ext.Net.MVC.PartialViewResult r = new Ext.Net.MVC.PartialViewResult(containerId);
r.ContainerId = containerId;
r.RenderMode = RenderMode.AddTo;
r.SingleControl = true;
return r;
}
and the error code is here:
Object reference not set to an instance of an object.
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.]
Ext.Net.MVC.PartialViewResult.ExecuteResult(Contro llerContext context) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2\Ext.Net\MVC\PartialViewRe sult.cs:190
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionRe sultWithFilters>b__19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionRe sultWithFilters>b__1b() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.ControllerActionInvoker.InvokeActio n(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestConte xt requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.ICont roller.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessReq uest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidD elegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSy nchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessReque st>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThun k>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTr ust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsync Result asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHan dler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +184
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.]
Ext.Net.MVC.PartialViewResult.ExecuteResult(Contro llerContext context) in C:\Users\Geoffrey McGill\Documents\Visual Studio 2010\Projects\Ext.NET\v2\Ext.Net\MVC\PartialViewRe sult.cs:190
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResult(ControllerContext controllerContext, ActionResult actionResult) +13
System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionRe sultWithFilters>b__19() +23
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +260
System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionRe sultWithFilters>b__1b() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActio nResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +177
System.Web.Mvc.ControllerActionInvoker.InvokeActio n(ControllerContext controllerContext, String actionName) +343
System.Web.Mvc.Controller.ExecuteCore() +116
System.Web.Mvc.ControllerBase.Execute(RequestConte xt requestContext) +97
System.Web.Mvc.ControllerBase.System.Web.Mvc.ICont roller.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessReq uest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidD elegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSy nchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.<>c__DisplayClasse.<EndProcessReque st>b__d() +50
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThun k>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTr ust(Action action) +22
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsync Result asyncResult) +60
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHan dler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +184
any hints?
thanks