-2

In the implemntation of a Displayview in a MVC application I am getting the NULL entry for Parameter error when I click on Edit option.

Used code for the controller is given below:

public ActionResult Edit(int ? id, ConferDetal cnfdr) 
    {
        try
        {
            using (ConBitEtities btis = new ConBitEtities())

            {
                btis.Entry(cnfdr).State = EntityState.Modified;
                btis.SaveChanges();
            }
                // TODO: Add update logic here

                return RedirectToAction("Scheduler");//view for the controller
        }
        catch
        {
            return View();
        }
    }

what is the reason for this error and how to solve this issues?

Ddevil Prasad
  • 117
  • 1
  • 14

2 Answers2

0

Change your route configuration as shown below

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Page", action = "Index", id = UrlParameter.Optional }

Make sure that your view has the following(similar) ActionLink

<%=Html.ActionLink("Edit", "ConfSchedule", new {id = "1"})%>
santosh singh
  • 27,666
  • 26
  • 83
  • 129
0

You are expecting an id parameter in your URL but you aren't supplying one.

enter image description here

Saineshwar Bageri - MVP
  • 3,851
  • 7
  • 41
  • 47