Model Binding using ASP.NET MVC, getting datainput to the controller.

Posted by Calibre2010 on Stack Overflow See other posts from Stack Overflow or by Calibre2010
Published on 2010-04-29T12:52:08Z Indexed on 2010/04/29 12:57 UTC
Read the original article Hit count: 309

Filed under:
|
|
|

Pretty Basic one here guys.

I have a View which holds 2 textfields for input and a submit button

<%using (Html.BeginForm("DateRetrival", "Home", FormMethod.Post)){ %>    
<%=Html.TextBox("sday")%>  
<%=Html.TextBox("eday")%>
<input type="submit" value="ok" id="run"/>
<% }%>

the following controller action which I want to bind the data input is as follows

    [AcceptVerbs(HttpVerbs.Get)]
    public ActionResult DateRetrival()
    {
        return View();
    }


    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult DateRetrival(string submit)
    {


        return null;
    }

When I debug this and look in the action methods parameter, the value is null. When I've entered values in both textboxes and and clicked the submit method.

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about model