c# - Do a post since a JQUERY dialog? -
i've got 2 buttons within of htmlform
, working well, differenciate of pass name of button in actionname. below:
[httppost] public actionresult index(string button, quizcompletedviewmodel q) { // quizcompletedviewmodel model of razor view ... } @using (html.beginform("index", "quiz", formmethod.post, new { id = "form" })) { <div> <!-- old code using 2 buttons post --> <div class="float-right"> @* <input name="button" type="submit" value="save" /> <input name="button" type="submit" value="done" />*@ <input name="button" type="button" value="done" /> </div> <div id="dialog-form"> <input name="button" type="button" value="cancel" /> <input name="button" type="submit" value="save" /> <input name="button" type="submit" value="done" /> </div> </div> <div id="question-container"> @for (int = 0; < model.questions.count; i++) { ... } </div> }
then need alter 2 buttons of current view , show pop these 2 buttons above (id="dialog-form"
). momment little hard me using jquery when user press buttons , perform post old code.
can lend me hand?
i think might help you, have tweak needs, jquery dialog displays go on button in code illustration , bind function it, can replace asp.net webforms __dopostback cause postback on mvc page.
$("#dialog").dialog({ autoopen: false, height: 380, width: 650, modal: true, close: function () { $('#btncreateaccount').button('refresh'); }, buttons: { 'continue': function () { $(this).dialog('close'); __dopostback($("#<%=btncreateaccount.clientid %>").attr("name"), ''); } } });
c# jquery asp.net-mvc jquery-ui asp.net-mvc-4
No comments:
Post a Comment