Exit the modal after return of the result

Asked

Viewed 248 times

0

After deleting and returning to index...

    [HttpPost]
    [ActionName("Delete")]
    public ActionResult DeleteConfirmed(int id)
    {
        _unitOfWork.UserRepository.Remove(id);
        _unitOfWork.Salva();
        return RedirectToAction("Index");
    }

My modal doesn’t go out.. inserir a descrição da imagem aqui

Code btnDelete

    <div>
        <div class="modal-footer">
        <button class="btn btn-default" data-dismiss="modal">CANCELAR</button>
        <input id="btnDelete" class="btn btn-danger" type="submit" value="EXCLUIR" />
    </div>

How do I get it out automatically?

  • $('.fashion-footer'). close() ?

  • So, I had tried to do so, in the event click of the button but depending on the attribute I put it does not come out or the model nor appears.

  • It worked that way. <script> $(Function () { $('#btnDelete').click(Function() { $('#myModal').modal('Hide'); }); }); </script>

  • I put this script above but then didn’t update my view automatically, so I only changed the controller the Return Redirecttoaction("Index"); Por Return Json(new { Success = true }); E worked, I didn’t need the script, vlw..

  • $( this ).dialog( "close" ); or something like that. I have a code that does this and works

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.