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 38: @foreach (var divcls in dc)
Line 39: {
Line 40: var students = Model.Where(S => S.Stud_Status.FirstOrDefault(A => A.AcademicYearId == SessionValues.Current.AcademicYear.AcademicYearId).Sett_DivisionsInClasses.DivInClassId == divcls.DivInClassId).ToList();
Line 41: var Btotal = students.Count(b => b.Gender == "M");
Line 42: var Ftotal = students.Count(f => f.Gender == "F");
Francis SusaimichaelPosted Mar 7, 2015, 8:00 PM
Zaid AnsariPosted Mar 7, 2015, 2:14 PM
Wrong Way This Code
1st Option Create a Model
2nd View Header This Code
@model YourProjectName.Models
Than
@using(Html.Begin("ActionName","ControllerName",FormMethod.Get And Post))
{
@Html.TextBox(model=>model.PropertyName)
}
understand My Brother
Thank,s