asp.net mvc 4 - Passing a string (besides the model) into a partial view in MVC4 -
how can send string partial view?
what send information model being viewed, partial view. this:
@{html.renderpartial("_phasecreate", new phase(), @model.id );} is possible?
if want send data isn't in model or view, should use following:
1) instead of @html.partial(), use @html.action("actionname", "controller", routevalues: new { id = model.id }) helper.
2) add controller:
public actionresult getmyview(int id) { viewbag.phase = new phase(); viewbag.id = id; // whatever doesn't in model ... return view("_phasecreate"); } and in partial view, can use info declare them:
<label>@viewbag.id</label> you can use following if need add data existing in model , view:
@html.partial("_phasecreate", new viewdatadictionary(new { phase = new phase(), id = model.id })) and use them this:
<label>@viewdata["id"].tostring()</label>
Comments
Post a Comment