@using (Ajax.BeginForm("CreateUser", "User", null, options, new { style = "margin-bottom:0;" })) { <div style="padding: 20px;"> <div style="text-align: right; font-size: .7em;">Press Esc to Close</div> <h2>New User</h2> @Html.LabelFor(m => m.UserName) @Html.TextBoxFor(m => m.UserName, new { }) @Html.ValidationMessageFor(m => m.UserName) @Html.LabelFor(m => m.Password) @Html.PasswordFor(m => m.Password, new { }) @Html.ValidationMessageFor(m => m.Password) @Html.LabelFor(m => m.Email) @Html.TextBoxFor(m => m.Email, new { }) @Html.ValidationMessageFor(m => m.Email) </div> <div class="form-actions" style="margin-bottom:0;"> <input class="btn btn-primary" type="submit" value="Save" /> </div> }
4 Réponses :
Ce code n'est pas ce code:
<a class="btn fade" data-toggle="modal" href="#CreateUserModal" >Launch Modal</a>
pour bootstrap 2.0
Définissez l'option "Afficher" sur FALSE CELA comme ceci. P>
$('#myModal').modal({show: false});
C'est la meilleure réponse en termes d'obtention de la boîte de dialogue de ne pas afficher sur INIT.
Cela fonctionne dans FF:
<div id="myModal" class="modal hide">...</div>
Vous pouvez faire un nouveau modal de son constructeur, alors vous avez Ultimate Strort> Control et peut manipuler l'objet modal comme vous voulez. // Create a new modal object
var modal = new $.fn.modal.Constructor();
// Set whatever defaults you want
$.fn.modal.defaults = { show: true, backdrop: 'static' };
$('#your_el').modal()
.show()
.on('hide', function() {
callbackFunction();
});
M'a pris pour toujours pour comprendre cela (je suis nouveau à bootstrap). Mais vous n'avez pas besoin d'initialiser aucun modal dans votre code de script, sauf si vous souhaitez personnaliser un modal.