Server Error in '/' Application.

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:


Line 187:    <script type="text/javascript">
Line 188:        function ShowMap() {
Line 189:            @if (Model.PostAddress != null)
Line 190:            {
Line 191:                @:initMap('@Html.Raw(Model.PostAddress != null ? Model.PostAddress.Lat : string.Empty)', '@Html.Raw(Model.PostAddress != null ? Model.PostAddress.Lag : string.Empty)', '<h5>@Html.Raw(Model.Title)</h5>@Html.Raw(Model.PostAddress.ContactName !=null ? "<p>"+Model.PostAddress.ContactName+"</p>" : string.Empty)@Html.Raw(Model.PostAddress.Address !=null ? "<p>Địa chỉ:" + Model.PostAddress.Address +"</p>" : string.Empty)@Html.Raw(Model.PostAddress.MobilePhone !=null ? "<p>Di động: " + Model.PostAddress.MobilePhone +"</p>" : string.Empty)@Html.Raw(Model.PostAddress.PhoneNumber!=null ? "<p>Điện thoại: " + Model.PostAddress.PhoneNumber + "</p>": string.Empty)', 'map_canvas');

Source File: C:\inetpub\vhosts\danangtoday.net\Views\Post\PostDetail.cshtml    Line: 189

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   ASP._Page_Views_Post_PostDetail_cshtml.<Execute>b__3_1() in C:\inetpub\vhosts\danangtoday.net\Views\Post\PostDetail.cshtml:189
   System.Web.WebPages.<>c__DisplayClass7.<RenderSection>b__5(TextWriter tw) +210
   ASP._Page_Views_Shared__Layout_cshtml.Execute() in C:\inetpub\vhosts\danangtoday.net\Views\Shared\_Layout.cshtml:195
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +279
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +125
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +124
   System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) +208
   System.Web.WebPages.WebPageBase.PopContext() +161
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +379
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +108
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +890
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +97
   System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +241
   System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +19
   System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +51
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +111
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34009