0

I'm new in using ajax data table with asp.net MVC. I quite understand how to dynamically return values in response to ajax call. But I don't understand how to get it to return real data SQL server database. How to access the server? Should I mention the table name only? And should I include that in my view? Here is a sample of the available dynamic return in the controller:

public class HomeController : Controller
{
    public ActionResult AjaxHandler(jQueryDataTableParamModel param)
    {
        return Json(new{
                sEcho = param.sEcho,
                iTotalRecords = 97,
                iTotalDisplayRecords = 3,
                aaData = new List<string[]>() {
                    new string[] {"1", "Microsoft", "Redmond", "USA"},
                    new string[] {"2", "Google", "Mountain View", "USA"},
                    new string[] {"3", "Gowi", "Pancevo", "Serbia"}
                    }
            },
        JsonRequestBehavior.AllowGet);
    }
}
tereško
  • 58,060
  • 25
  • 98
  • 150
Daniel
  • 15
  • 5

0 Answers0