Reputation: 51321
@using (Html.BeginForm("Index", "Bill"))
{
@Html.Label("FromDate")
@Html.DropDownList("FromDate",Model.DateList)
@Html.Label("ToDate")
@Html.DropDownList("ToDate", Model.DateList)
@Html.ActionLink("Filter", "Index", "Bill") // I want to post to Index
}
[HttpPost]
public ActionResult Index(string fromDate, string toDate)
{
//Process
}
What is the correct way to post the date range to Index action?
What kind of URL do I need to specify?
I appreciate your answers.
Upvotes: 0
Views: 898
Reputation: 57469
Your @Html.ActionLink("Filter", "Index", "Bill")
is just an anchor tag. You need to have a submit button:
<input type="Submit" />
I think thats all you need to submit your 2 values. The submit button uses the POST
method that is automatically specified in your Html.BeginForm()
Upvotes: 1