Wednesday, 15 August 2012

asp.net mvc - Object reference not set to an instance of an object - highlighting -



asp.net mvc - Object reference not set to an instance of an object - highlighting -

this question has reply here:

what nullreferenceexception , how prepare it? 21 answers

i used , worked, shows error, suggesstion? object reference not set instance of object mean?

@foreach (var item in model) { int daysleft = (item.membership.paiddate - datetime.today).days; string style = daysleft <= 7 ? "background-color:red" : null; <tr style="@style">

to me seems item.membership null

object reference not set instance of object means variable trying utilize access object doesnt have reference object.for example

employee e;

if without writing e= new employee(), if seek get/execute property/method of employee type error because e not referring instance of type.

asp.net-mvc nullreferenceexception

No comments:

Post a Comment