Anabik Anabik - 1 year ago 145
ASP.NET (C#) Question

How to remove data from bootstrap modal while hiding it

I am working on

. Currently my scenario is that when I save data from bootstrap modal popup it saves perfectly. When I open it for the second time, the values previously saved shows up in the modal popup. The model called in the bootstrap is filled with previous values when opened for the second time.

Is there any way to clear it when the modal closes after saving the data. So that when I opens again it would load the fresh data.

Below is the code for the action method


public ActionResult Savenfo(int Id, string comment, byte Status, string Code, string Rev, string Email, string Phone)

var form = objForm.Get(Id);
if (form != null)
if (CurrentUserTicket.Dval!= form.DId)
return new UnauthorizedActionResult();

form.Comment = comment;
form.Status = Status;
form.Code = Code;
form.Email= Email;
form.Phone= Phone;
form.Rev = Rev;

return new AjaxActionResponse(true, "Information has been saved.");


return new AjaxActionResponse(false, "The specified Information does not exist.");

Answer Source

You should clear your modal div html because you are re-generating the modal from partial view. Below is the code to remove modal element.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download