asp.net mvc - MVC Html.TextBoxFor binding to something other than model object -
i've got base controller passing object properties viewbag object on every view. wondering, possible bind html.editorfor or html.textboxfor other view's model object? essentially, goal contact form hidden in modal on every page don't want have pass new object every view form. know can done using standard html/ajax (which i'm doing right now) i'm curious if it's possible. in advance.
in basecontroller:
protected override void onactionexecuting(actionexecutingcontext filtercontext) { viewbag.contactus = new model.contactus(); base.onactionexecuting(filtercontext); }
then in _layout, i've got this:
@using (ajax.beginform("contactus", "contact", new ajaxoptions { updatetargetid = "result" })) { @html.textboxfor(????=> viewbag.contactus.firstname) <input type="submit" value="ok" /> }
jay
Comments
Post a Comment