Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
System.NullReferenceException: Object reference not set to an instance of an object.

What I have tried:

Line 122:                                        
Line 123:                                            Select Class
Line 124:                                            @foreach (var item in Model.ClassList)
Line 125:                                            {
Line 126:                                                @item.ClassName

Source File: F:\Education_SD\CMS\CODE\CMS.Institute\Views\Report\StudentAttendanceReport.cshtml    Line: 124 

Stack Trace: 

[NullReferenceException: Object reference not set to an instance of an object.]
   ASP._Page_Views_Report_StudentAttendanceReport_cshtml.Execute() in
Updated 29-Jul-18 18:44pm

1 solution

The problem is that foreach can not iterate a null variable, and in your case Model.ClassList is null...
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900