public class UserModel
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
    }
2. สร้าง View แสดงผลลัพธ์หลังจาก รับข้อมูลจาก form เสร็จ
3. สร้างฟังชัน 
        public ActionResult Search(UserModel model)
        {
            return View();
        }
4. สร้าง view รับข้อมูลจาก form
<div>
    <h1>Razor form</h1>
    @using (Html.BeginForm("Search", "Home"))
    {
        @Html.LabelFor(m => m.FirstName)
        @Html.TextBoxFor(m => m.FirstName)
        @Html.LabelFor(m => m.LastName)
        @Html.TextBoxFor(m => m.LastName)
        <input type="submit" value="Search" />
    }
</div>
 
ไม่มีความคิดเห็น:
แสดงความคิดเห็น