Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to hide status query string from Url after updating from MVC Controller
    primarykey
    data
    text
    <p>I have a view which shows info according to a specific Id.</p> <p>My Controller is:</p> <pre><code> public ActionResult ModifyWorkout(string WorkoutId, bool? Status) { Guid pkWorkoutId = new Guid(WorkoutId); BLLWorkouts _objBLLWorkouts = new BLLWorkouts(); var WorkoutRow = _objBLLWorkouts.GetOneWorkout(pkWorkoutId); WorkoutModel PageModel = new WorkoutModel { pkWorkoutId = WorkoutRow.pkWorkoutId, WorkoutName = WorkoutRow.WorkoutName, WorkoutNote = WorkoutRow.WorkoutNote, Sessions = WorkoutRow.Sessions, CmpFlag = WorkoutRow.CmpFlag, tblWorkoutSessions = WorkoutRow.tblWorkoutSessions }; ViewBag.UpdateStatus = Status; return View(PageModel); } </code></pre> <p>I always pass a Query String as Workout id for getting a single record. But when I update that records it is posting to another action:</p> <pre><code> public ActionResult UpdateWorkout(WorkoutModel model) { bool _status = false; BLLWorkouts _objBLLWorkouts = new BLLWorkouts(); tblWorkout _row = new tblWorkout(); _row.WorkoutName = model.WorkoutName; _row.WorkoutNote = model.WorkoutNote; _row.Sessions = model.Sessions; _row.pkWorkoutId = model.pkWorkoutId; _row.CmpFlag = model.CmpFlag; _status = _objBLLWorkouts.UpdateWorkout(_row); return RedirectToAction("ModifyWorkout", new { WorkoutId = model.pkWorkoutId, Status = _status }); } </code></pre> <p>Now problem is that after updating my url becomes like this:</p> <pre><code>/ModifyWorkout?WorkoutId=438b6828-1a21-4ad0-9e40-485dda75b1f6&amp;Status=true" </code></pre> <p>And Status message is shown even after refreshing the page due to <code>&amp;Status=true</code> in Url.</p> <pre><code>&lt;div &gt; @if (ViewBag.UpdateStatus != null) { if (ViewBag.UpdateStatus) { &lt;span class="successmsgCommon"&gt;Workout updated successfully.&lt;/span&gt; } else { &lt;span class="errormsgCommon"&gt;Workout was not updated. Please try again.&lt;/span&gt; } } &lt;/div&gt; </code></pre> <p>Is there any way to solve this?</p>
    singulars
    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.
 

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