How can I pass form collection to controller with jquery or ajax on change for drop down list?
Can I call an action in my controller and give it my form if I don't use submit button?
@using (Html.BeginForm("Create","Order", FormMethod.Post, new {@class = "form-horizontal", @name="forma"})) {
@Html.ValidationSummary(true)
@Html.Partial("_CreateOrEdit", Model)
<div class="form-actions no-margin-bottom">
<input type="submit" [email protected]("String_Save") class="btn btn-primary" >
<a href="@Url.Action("Index", "Order")" class="btn btn-primary">@Html.LocalizeString("String_BackToList")</a>
</div>
}
and part of that partial is (it has many more fields but I think they don't matter for question)
<div class="control-group">
<div class="control-label">
@Html.LocalizedLabelFor(model => model.BuyerId)
</div>
<div class="controls">
@Html.DropDownListFor(model => model.BuyerId, ((IEnumerable<SalesAgent.Core.Entities.Buyer>)ViewBag.PossibleBuyers).Select(option => new SelectListItem
{
Text = (option == null ? "None" : option.Name),
Value = option.Id.ToString(),
Selected = (Model != null) && (option.Id == Model.BuyerId)
}), @Html.LocalizeString("String_Choose"),new {@class="searchable" })
@Html.ValidationMessageFor(model => model.BuyerId)
when I change dropdown list I want to call an action from my controller and pass it my current form data. How do I do that?