-2

Hi I am getting this error while loading a partial view

Line 27: @foreach (var item in Model)

the stack trace is:

[NullReferenceException: Object reference not set to an instance of an object.] ASP._Page_Views_ServiceRevenue__ServicePartial_cshtml.Execute() in f:\Guri_Projects\DM\DM\Views\ServiceRevenue_ServicePartial.cshtml:27 System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +197 System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105

partial view start with:

@model IEnumerable<DM.Models.DB.ServiceWiseRevenue>

<div class="row">
    <div class="col-lg-12">
Guri
  • 3
  • 1
  • 4
  • 1
    Make sure that your Model isn't null. – Jesse Moreland Dec 20 '16 at 22:16
  • 1
    Possible duplicate of [What is a NullReferenceException, and how do I fix it?](http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) –  Dec 21 '16 at 02:31
  • You have not passed a model to the view so your model is `null` - hence the exception. Read the duplicate carefully to understand how to debug your code. –  Dec 21 '16 at 02:32
  • But i already added Model in top line as already mentioned. When i remove Ienumerable it is workin for one column only but thrown error with Ienumerable. – Guri Dec 21 '16 at 07:41

1 Answers1

0

i was passing the null value to View. Now it is resolved as i put some condition in controller before returning partial view. Thanks

Guri
  • 3
  • 1
  • 4