ASP.NET MVC Form Post

后端 未结 3 428
夕颜
夕颜 2020-12-19 01:45
   
相关标签:
3条回答
  • 2020-12-19 02:03

    It belongs to your url routes, you defined.

    In your case the form ist looking for an controller named "Villa" and the action inside of it named "Add".

    Maybe you should read ScottGu's blog post: http://weblogs.asp.net/scottgu/archive/2008/09/02/asp-net-mvc-preview-5-and-form-posting-scenarios.aspx

    0 讨论(0)
  • 2020-12-19 02:24

    Have you tried something like this? Pseudocode...

    public class VillaController : Controller 
    {
          public ActionResult Add(string name)
          {
              // Code...
          }
    }
    
    0 讨论(0)
  • 2020-12-19 02:30

    This works for ASP.Net MVC Beta.

     public ActionResult Add( string name ) {
        ....
     }
    
     or
    
     public ActionResult Add( FormCollection form ) {
          string name = form["Name"];
     }
    
     or
    
     public ActionResult Add( [Bind(Prefix="")]Villa villa ) {
           villa.Name ...
     }
    
    0 讨论(0)
提交回复
热议问题
Name: