Click here to Skip to main content
15,906,467 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
The parameters dictionary contains a null entry for parameter 'date' of non-nullable type 'System.DateTime' for method 'System.Web.Mvc.ActionResult DeleteStudentAttendance(System.DateTime, Int64, Int64, Int32)' in 'CMS.ClientPortal.Controllers.TransController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters


What I have tried:

public ActionResult DeleteStudentAttendance(DateTime date, Int64 classId, Int64 divId,int timing)
        {


            if (LoggedInUser != null && LoggedInUser.IsAuthenticated)
            {
                TransactionRepositories.DeleteStudentAttendanceForDate(date, LoggedInUser.BranchId, LoggedInUser.InstituteId, classId, divId,timing);

                TempData["actionresult"] = "Student Attendance Data For Class Deleted Successfully!!!";
                return Json("success");


            }
            return Json("error");

        }
Posted
Updated 3-Aug-18 0:31am
Comments
Member 12227707 3-Aug-18 7:03am    
Now i will change the sequence but it can not work..

The parameters dictionary contains a null entry for parameter 'classId' of non-nullable type 'System.Int64' for method 'System.Web.Mvc.ActionResult DeleteStudentAttendance(Int64, System.DateTime, Int64, Int32)' in 'CMS.ClientPortal.Controllers.TransController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
Parameter name: parameters

1 solution

You've declared a method which takes a DateTime as the first parameter - and DateTime is a Value Type, which means it can;t accept a null value, which is what you are passing to it.

Read the error message, and it explains what you have to do in order to make it work with your existing data, but I'd look at the code that calls the method and work out why your code thinks it's a good idea to have a null date at all ...
 
Share this answer
 

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



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