javascript - Inserting a functional strongly-typed create view in a modal popup -
i want have menu item on site, should open create view wherever in site. view inserts basic properties database's tables. view:
<!doctype html> @model its.models.server @using system.web.mvc.ajax <html> <head> <meta name="viewport" content="width=device-width" /> </head> <body> <div title="boo, popup">get pop-up @using (ajax.beginform("addserver", new ajaxoptions { onsuccess = "onsuccess" })) { @html.antiforgerytoken() <div> <fieldset> <legend>add new server</legend> <div class="editor-label"> @html.labelfor(model => model.server_name) </div> <div class="editor-field"> @html.textboxfor(model => model.server_name) </div> <div class="editor-label"> @html.validationmessagefor(model => model.server_name) </div> <p> <input type="submit" value="submit" /> </p> </fieldset> </div> } </div> </body> </html>
my controllers simple:
public actionresult addserver() { return view(); } [httppost] [validateantiforgerytoken] public actionresult addserver([bind(include = "server_name")] server @server) { if (modelstate.isvalid) { db.servers.add(@server); db.savechanges(); } return partialview(@server); }
first of all, possible? want able insert values through model after all. tried @ least visualize in popup answer article, no success: open view pop up opens popup no content.
save lot of grief , use javascript library jquery ui, or extjs, or kendo. have extensive documentation make javascript , css parts of rendering dialog quite painless. there's little need write own code when there these libraries have been tested , "blessed" masses already.
Comments
Post a Comment