asp.net mvc - .net mvc partial view -


when creating partial views .net mvc, 1 have create 1 edit action , create action or 1 partial view enough both actions. here considering views dropdown lists, checkboxes, etc.

update 1

here have been struggling today:

i have model couple of members , have created partial view follows:

in controller have:

public actionresult trip() {   return view(); } 

inside view folder (trip.cshtml):

@model tests.models.mission <div id="contents">  <div class="editor-label">  @html.labelfor(model => model.tripname, "tripname") </div> <div class="editor-field">  @html.dropdownlist("tripname", string.empty)  @html.validationmessagefor(model => model.tripname) </div> <div class="editor-label">  @html.labelfor(model => model.giftname) </div> <div class="editor-field">  @html.editorfor(model => model.giftname)  @html.validationmessagefor(model => model.giftname) </div> 

in edit action:

i loading page using jquery load method , works ok create action edit action, data not being loaded. 404 error

$("#dynamicform").load("/things/trip #contents", function(response, status, xhr) {                     if (status == "error") {                         var msg = "";                         $("#dynamicform").html(msg + xhr.status + " " + xhr.statustext);                     }                 }); 

and yes, have tried @html.renderpartial , works example trying use jquery.

you can use single partial view if want to, , bind model. in edit case populated data while in create mode bind empty model object.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -