Passing Values from a View to itself with parameters getting null values ?

Posted by vsj on Stack Overflow See other posts from Stack Overflow or by vsj
Published on 2010-04-30T22:24:35Z Indexed on 2010/04/30 22:27 UTC
Read the original article Hit count: 122

Filed under:
|
|
|
|

Hi all, I am trying to get values from a view which i have the code below and I am taking the start date value from the view input text box and posting it back but I am still getting null except for the apikey and userkey.Here are the two views..

public ActionResult View1(string apiKey, string userId)
        {
            StartGoalViewModel vm = new StartGoalViewModel();
            vm.ApiKey = apiKey;
            vm.UserId = userId;
            vm.GoalTypeId =1;
            vm.StartDate = null;
            return View(vm);
        }
VIEW1.ASPX
<% Html.BeginForm(); %>
<%= Html.TextBox("name", Model.StartDate) %>
    <input type="submit" value="Start" />
 <% Html.EndForm(); %>
[HttpPost]
        public ActionResult VIEW1 (StartGoalViewModel fm)
        {
         // I  get StartDate null...
     }

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc