Reputation: 2711
This is my form:
@using (Html.BeginForm())
{
<h3 class="text-blue title-article editable">thisStr</h3>
<input type="submit" value="xxxx" class="btn btn-success" name="xxxx"/>
}
@model.title is part of an inline-editable that i can change to whatever, what i need to do is pass the string in the h3 to this controller-method:
public ActionResult method(string test)
{
someProp = test;
return View();
}
I think my problem is this line:
<input type="submit" value="xxxx" class="btn btn-success" name="xxxx"/>
Can someone help me out, thanks!
Upvotes: 0
Views: 42
Reputation: 10862
Add a @Html.HiddenFor((p) => Model.Title)
inside your form, which will then submit the text back with the POST for you.
Upvotes: 1
Reputation: 62488
Put this in the form:
@Html.HiddenFor(x=>x.Title)
view:
@using (Html.BeginForm("YourAction","YourController",FormMethod.Post))
{
<h3 class="text-blue title-article editable">@Model.Title</h3>
@Html.HiddenFor(x=>x.Title)
<input type="submit" value="xxxx" class="btn btn-success" name="xxxx"/>
}
in your action:
[HttpPost]
public ActionResult YourAction(FormCollection form)
{
sting vl= form["Title"].ToString();
return View();
}
Upvotes: 1