This project is read-only.

How to pass Model values to Controller while filtering ?

Apr 19, 2016 at 4:12 PM
Hi all,

I am new to Grid.Mvc. I have a scenario where I load the grid based on some condition. For example I have a drop-down on my page to select Active or Inactive Employees. If no value is selected only active employees are bound to the grid. But when user selects Inactive employees grid is bound with that data. But when user tries to to apply search filter on inactive employee data by default active employees are loaded. When grid filter calls the controller the Model values (Active/Inactive information) are lost. Is there any way I can avoid this. ?
Apr 19, 2016 at 4:32 PM
Hi I found answer for this issue from previous discussions. By adding "FormMethod.Get" in the Html.BeginForm.

It was a small change "@using (@Html.BeginForm("Index", "Home"))" to "@using (@Html.BeginForm("Index", "Home",FormMethod.Get))"
Aug 2, 2016 at 8:32 PM
Hi "@using (@Html.BeginForm("Index", "Home",FormMethod.Get))" worked when the model was small.

Now I have a very huge model with many data fields.

This doesn't work. Could you please suggest a solution ?

When I click on sort/filter/paging calls the HTTPGet but I want to call HttpPost

[HttpGet]
public ActionResult Index(int EmpId)
{
..........
..........
return View(model);
}

[HttpPsot]
public ActionResult Index(Employee model)
{
..........
..........
return View(model);
}