Ich habe ein Problem im MVC ASP.NET-Projekt. ich arbeite mit LINQ technology.When Ich möchte einen Datensatz-Tabelle einzufügen, wird dieser Fehler shown.although Einsatz Aktion vorgeformten: **Fehler beim Ausführen der Indexaktion
ERROR:
Server Error in '/' Application. The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'MVCJahan_oil.Controllers.getehController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters 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.
Controller-Methoden für Einsatz (erstellen) :
public ActionResult Index(int id)
{
var query= from gete in l_class.getehs where gete.request_no == id select gete;
this.Session["req_no"] = id;
return View(query.ToList());
}
[HttpPost]
public ActionResult Create([Bind(Exclude = "id")]geteh gte)
{
try
{
l_class.getehs.InsertOnSubmit(gte);
l_class.SubmitChanges();
return RedirectToAction("Index", new { id = System.Convert.ToInt32 (Session["req_no"].ToString()) });
}
catch
{
return View();
}
}
Sie könnten Ihren Fragetitel aktualisieren möchten, um ein wenig anschaulicher zu sein ... – James