Note that there are some explanatory texts on larger screens.

plurals
  1. POCall post edit action from razor view mvc4
    primarykey
    data
    text
    <p>This question might have been asked several times, however it is not working in my case, so please bear with me.</p> <p>I have the below actions in my controller:</p> <pre><code> [HttpPost] public ActionResult Edit(Organization obj) { if (ModelState.IsValid) { OrgRepo.Update(obj); return RedirectToAction("Details"); } else return View(); } public ActionResult Edit(int id) { return View(); } </code></pre> <p>I am trying to update the data into database by calling post edit action. For this purpose, I am calling the edit action as below:</p> <pre><code>@foreach (var item in Model) { var test = item.PartyId; &lt;tr id="@test"&gt; &lt;td class ="txt"&gt; &lt;input type="text"class="txt" value="@Html.DisplayFor(modelItem =&gt; item.Caption)"/&gt; &lt;/td&gt; &lt;td class ="txt"&gt; &lt;input type="text"class="txt" value="@Html.DisplayFor(modelItem =&gt; item.NameInUse)"/&gt; &lt;/td&gt; &lt;td class ="txt"&gt; &lt;input type="text"class="txt" value="@Html.DisplayFor(modelItem =&gt; item.Description )"/&gt; &lt;/td&gt; &lt;td&gt; @using (Html.BeginForm()) { @Html.ActionLink("Edit", "Edit", "Org", null, new { @obj = item }) } &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>However when I click on edit I am getting exception: 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 'Dwiza.Controllers.OrgController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter. Parameter name: parameters</p> <p>My questions:</p> <ol> <li>can somebody help how to fix this?</li> <li>Why it get edit action is getting invoked instead of post edit?</li> <li>What are better ways to invoke edit action among invoke through jquery, or ajax or any other if you can suggest better ways of doing it?</li> </ol> <p>Thanks in advance//</p>
    singulars
    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