Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model GWeb.Models.FilterModel
- @using (Html.BeginForm())
- {
- @Html.ValidationSummary(true)
- <fieldset>
- <legend>Search criteria</legend>
- @(Html.Telerik().ComboBox()
- .Name("UserName")
- .BindTo(new SelectList(ViewBag.workerList as System.Collections.IEnumerable, "Id", "Desciption"))
- .Value(Model.UserName))
- @(Html.Telerik().DatePicker()
- .Name("StartWork")
- .Value(Model.StartWork))
- @(Html.Telerik().DatePicker()
- .Name("EndWork")
- .Value(Model.EndWork))
- <input type="submit" value="Filter" />
- </fieldset>
- }
- @{Html.RenderPartial("EmployeeList", (IEnumerable<GWeb.Entities.Work>)ViewBag.employeeList);}
- <td>
- <a href="@Url.Action("Edit", "Admin", new { id = item.Id })">
- <img src="/Content/edit.png" alt="Edit" title="Edit" width="22" height="22" />
- </a>
- public class FilterModel
- {
- public string UserName { get; set; }
- public DateTime? StartWork { get; set; }
- public DateTime? EndWork { get; set; }
- //...
- }
- <form action="~/Search/Index" method="GET">
- ...
- <submit />
- </form>
- class SearchController : Controller
- {
- public ActionResult Index(FilterModel model = null)
- {
- Session["SearchUrl"] = Request.UrlReferrer.ToString();
- var results = get page of results...
- return View(results);
- }
- [HttpPost]
- public ActionResult Edit(EditModel model)
- {
- //update the model...
- return Redirect(Session["SearchUrl"]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement