I'm fairly new to MVC, and need help understanding partial updates implementation similar to UpdatePanel functionality.
I have certain filters on the LHS of the page and a table(DataTable) on the RHS. When the user selects a filter, I want the table data to change according to the filter. I'm trying to load only the PartialView containing the table instead of loading the whole page. However, I am running into difficulties at the beginning itself.
Questions -
Can something like this be achieved using Html.BeginForm? Like shown here. I can't really find detailed documentation on Html.BeginForm, the MSDN site explains the technicalities, but I'm really not sure whether it is necessary to always use it, and where it is absolutely required.
What I've tried -
I've tried using jQuery.load() shown here. However, when I try to load my partial view like this, i run into a 400 Bad Request error.
All I'm doing here is -
In the View -
I've tried this -
$('#contentDiv').load('<%= @Url.Action("Index", "Grid") %>');
and this -
$.post('<%= @Url.Action("Index", "Grid")%>', function (data) {
$('#contentDiv').html(data); }
I've also tried using #get and that doesnt work either.
In the controller -
public ActionResult Index()
{
List<Models.GridData> tableData= new List<GridData>();
try
{
tableData= hvUtil.FillGrid();
return PartialView(notes);
}
Can anyone suggest how to get things working?