I'm using jQuery Datatable and server side proccessing as data source in my ASP.Net MVC application. I need to apply search term in my query but I don't know how to catch it.
here is short version of my controller :
public JsonResult Index(POFilter m) {
return Json(new {
data = data,
...
})
}
POFilter.cs
public class POFilter
{
public int start { get; set; }
public int length { get; set; }
public int draw { get; set; }
public List<DT_Order> order { get; set; }
public string[] search { get; set; }
public POFilter()
{
start = 0;
length = 10;
draw = 1;
}
}
public class DT_Order
{
public int column { get; set; }
public string dir { get; set; }
}
but for some reason the search property is always null. you can see the parameters which are passed by jquery datatable:
order[0][column]:0
order[0][dir]:desc
start:0
length:10
search[value]:my search term
search[regex]:false
how can I get my search term from passed parameters?
orderis also null?order[0].columnandorder[0].dirhave wrong values. anyway, I found the answer. I should usem.search = Request["search[value]"]or in generalRequest[key]