Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC 3 Framework Edit and Details problems
    primarykey
    data
    text
    <h1>Background and Problem</h1> <p>I have successfully produced a database, models from the database, and controllers which produced default pages. The current problem that I am having is Edit and Delete pages, they are constantly producing problems and have tried </p> <ol> <li>Remove contexts and readd</li> <li>Delete the models and everything and re-add</li> </ol> <h2>The Problem statement that is produced when I click on the edit/delete pages from the details page:</h2> <p>Server Error in '/' Application.</p> <p>The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Edit(Int32)' in 'Olympics2012.Controllers.AthleteController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters</p> <p>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. </p> <p>Exception Details: System.ArgumentException: The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Edit(Int32)' in 'Olympics2012.Controllers.AthleteController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters</p> <h2>Controller Edit Code</h2> <pre><code> public ActionResult Edit(int? id) { Athlete athlete = db.Athletes.Find(id); return View(athlete); } [HttpPost] public ActionResult Edit(Athlete athlete) { if (ModelState.IsValid) { db.Entry(athlete).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(athlete); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload