比较乱,先记录下再说

Models and Model Binders in MVC Applications(model绑定)  http://msdn.microsoft.com/en-us/library/dd410405.aspx

Walkthrough: Using MVC View Templates with Data Scaffolding  http://msdn.microsoft.com/en-us/library/dd405231.aspx

Rendering a Form in ASP.NET MVC Using HTML Helpers(重要属性)   http://msdn.microsoft.com/en-us/library/dd410596.aspx

Passing Data in an ASP.NET MVC Application(如何在Control和view之间数据传值)  http://msdn.microsoft.com/en-us/library/dd394711.aspx
 
 
  • ActionLink — Links to an action method.

  • BeginForm * — Marks the start of a form and links to the action method that renders the form.

  • CheckBox * — Renders a check box.

  • DropDownList * — Renders a drop-down list.

  • Hidden — Embeds information in the form that is not rendered for the user to see.

  • ListBox — Renders a list box.

  • Password — Renders a text box for entering a password.

  • RadioButton * — Renders a radio button.

  • TextArea — Renders a text area (multi-line text box).

  • TextBox * — Renders a text box.

     

     PersonController : Controller
    {
        static List<Person> people = new List<Person>();

        
    //
        
    // GET: /Person/
        public ActionResult Index()
        {
            
    return View(people);
        }

        
    //
        
    // GET: /Person/Details/5
        public ActionResult Details(Person person)
        {
            
    return View(person);
        }

        
    //
        
    // GET: /Person/Create
        public ActionResult Create()
        {
            
    return View();
        } 

        
    //
        
    // POST: /Person/Create
        [AcceptVerbs(HttpVerbs.Post)]
        
    public ActionResult Create(Person person)
        {
            
    if (!ModelState.IsValid)
            {
                
    return View("Create", person);
            }

            people.Add(person);

            
    return RedirectToAction("Index");
        }
    }

     

     

  • 相关文章:

    • 2021-12-05
    • 2022-01-10
    • 2021-08-17
    • 2022-12-23
    • 2021-04-06
    • 2021-07-21
    • 2021-09-22
    • 2022-12-23
    猜你喜欢
    • 2021-08-27
    • 2021-06-05
    • 2021-04-08
    • 2021-08-31
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    相关资源
    相似解决方案