Note that there are some explanatory texts on larger screens.

plurals
  1. POasp.net mvc change date when Updating
    text
    copied!<p>When I Postpone Event I would like the also change the Event Start Date to the Postponed Date ? The Form Should return to Update The Event Start Date and Event End Date</p> <pre><code> public ActionResult Postpone(int ID) { var events = db.Events.Find(ID); return PartialView(events); } // // POST: /Events/Postpone/5 [HttpPost] public ActionResult Postpone(FormCollection Collection) { var ID = Collection["Event_ID"]; int intID = int.Parse(ID); var events = db.Events.Find(intID); // If OK to Postpone , set status to P events.Event_Status = "P"; if (TryUpdateModel(events)) { //LIke to have option to change Event on the Form db.SaveChanges(); string ConfirmMessage = "Event Successfully Postponed"; return RedirectToAction("Confirm", "Admin", new { ConfirmMessage = ConfirmMessage }); } else { return PartialView(events); } } </code></pre> <p>this is my Postpone View</p> <pre><code> @model MvcEvents.Models.Event &lt;h3&gt;Are you sure you want to Postpone this?&lt;/h3&gt; @using (Ajax.BeginForm("Postpone", "Admin", new AjaxOptions { UpdateTargetId = "my-modal- dialog", OnBegin = "Dialog.Updating()", OnSuccess = "Dialog.Update()" })) { &lt;fieldset&gt; &lt;legend&gt;Event&lt;/legend&gt; @Html.HiddenFor( model =&gt; model.Event_ID) &lt;div class="display-label"&gt;Event Location&lt;/div&gt; &lt;div class="display-field"&gt;@Html.DisplayFor(model =&gt; model.Section.City)&lt;/div&gt; &lt;div class="display-label"&gt;Event Start Date&lt;/div&gt; &lt;div class="display-field"&gt; @Html.DisplayFor(model =&gt; model.Event_Start) &lt;/div&gt; &lt;div class="display-label"&gt;Event End Date&lt;/div&gt; &lt;div class="display-field"&gt;@Html.DisplayFor(model =&gt; model.Event_End)&lt;/div&gt; &lt;div class="display-label"&gt;Event Description&lt;/div&gt; &lt;div class="display-field"&gt;@Html.DisplayFor(model =&gt; model.Event_Description) &lt;/div&gt; &lt;/fieldset&gt; &lt;p&gt; &lt;input type="submit" value="Postpone" class="demo-button ui-state-default ui-corner-all" /&gt; &lt;/p&gt; } </code></pre>
 

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