@model ReportViewer.Models.ViewModel.EntryViewModel @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>Index</title> </head> <body> <div> @using (Html.BeginForm("UserReportView", "HomeController", FormMethod.Post)) { <input id="UserToLookUp" type="text" width="50" name="UserToLookUp" /> @Html.TextBoxFor(model => model.UserToLookUp) <input type = "submit" value = "View" /> } </div> </body> </html>
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace ReportViewer.Models.ViewModel { public class EntryViewModel { public string CurrentUser { get; set; } public string UserToLookUp { get; set; } } }
using ReportViewer.Models.ViewModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; namespace ReportViewer.Controllers { public class HomeController : Controller { // GET: Home public ActionResult Index() { EntryViewModel vm = new EntryViewModel(); return View(vm); } //[HttpPost] public ActionResult UserReportView(EntryViewModel vm) { TempData["ID"] = vm.UserToLookUp; return RedirectToAction("Index", "Viewer"); } } }
@using (Html.BeginForm("UserReportView", "HomeController", FormMethod.Post))
<input id="UserToLookUp" type="text" width="50" name="UserToLookUp" />
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)