Reputation: 2207
I am new to asp.net MVC and i am wondering how i would go about passing a date from a Jquery DateTime picker and pass it across to the controller then do some linq and return the new value to the page.
I have had a play around with @Html.BeginForm but with no joy.
ViewCode
@Html.BeginForm("GetSigmaDateInfo", "HomeController", FormMethod.Post)
{
<h3>Date :</h3> <input type="text" id="dp" />
<input type="submit" value="Update" />
}
On the button click above i would like to retrieve data from a linq statement and return it to the page.
Controller Code
[HttpPost]
public ActionResult GetSigmaDateInfo(string Date)
{
string test = null;
return View();
}
Upvotes: 0
Views: 108
Reputation: 2573
2 Issues in Code
And as you are new to MVC, please read this article http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx
It gives everything you want and tells everything
Upvotes: 2
Reputation: 1998
the textbox should have the same name as the parameter.. like below
public ActionResult GetSigmaDateInfo(string dp)
&
<input type="text" id="dp" name="dp" />
-
also, remove "controller" keyword from the form definition "Home" instead of "HomeController"
Upvotes: 2