What's the best way to create a confirmatin modal window in asp.net mvc? -
what best way create confirmation modal window in asp.net mvc 4?
currently have:
if (viewbag.deleteisvisible) { <button onclick= "if(confirm('are sure want delete?')) location.href='@url.action("delete", "home", new { id = model.id })'; else return false;" >delete</button> }
but don't care old school looking javascript box. hoping have more control , make little more rich content having display box confirmation window c# has. there supported mvc framework this? haven't had luck finding something.
as code mentioned above, did stuff using inline click event. in point of you can use jquery better control.
<button id="btndelete">delete</button> <script> $('#btndelete').click(function(){ if(confirm('are sure want delete?')) location.href='@url.action("delete", "home", new { id = model.id })'; else return false; }); </script>
or use jquery plugings jquery.confirm - http://myclabs.github.io/jquery.confirm/ fancy ui.
Comments
Post a Comment