asp.net-mvc – asp.net mvc formcollection

前端之家收集整理的这篇文章主要介绍了asp.net-mvc – asp.net mvc formcollection前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
public  ActionResult Edit(int  id,FormCollection formValues) {

    // Retrieve existing dinner
    Dinner dinner = dinnerRepository.GetDinner(id);

    // Update dinner with form posted values
    dinner.Title = Request.Form["Title"];
    dinner.Description = Request.Form["Description"];
    dinner.EventDate = DateTime.Parse(Request.Form["EventDate"]);
    dinner.Address = Request.Form["Address"];
    dinner.Country = Request.Form["Country"];
    dinner.ContactPhone = Request.Form["ContactPhone"];

    // Persist changes back to database
    dinnerRepository.Save();

    // Perform HTTP redirect to details page for the saved Dinner
    return RedirectToAction("Details",new { id = dinner.DinnerID });
}

formValues未在方法中使用.它的目的是什么?

解决方法

猜你在找的asp.Net相关文章