c# - Passing value from view to controller -
ok, asked similar question , got answers back. however, did not express problem accurately give go here:
this view
@using (html.beginform()) { <h3 class="editable">@model.title</h3> <input type="submit" value="submit"> }
the <h3>
has class "editable"
in case means can edited inline-editor.
@model.title
is properties database able change inline-editor.
this code generate same result:
@using (html.beginform()) { <h3 class="editable">@model.title</h3> <input type="text" id="testinput" name="testinput" /> <input type="submit" value="submit"> } controller: [httppost] public actionresult faq(string testinput) { page.title = testinput; return view(); }
allthough, not use inline-editor like.
is there maybe way treat <h3>
if textbox
allowing me send whatever in there controller?
i want make clear not want send @model.title
controller directly. want send value created clicking on <h3>
, using inline-editor change it.
thank you!
when submit form in fashion controller try , match correct object type. if want pass 1 or 2 objects try using action links. these should allow pass in values names match control methods.
Comments
Post a Comment