when I am posting the form back using Ajax.ActionLink() I am getting null values for all the properties. I have also tried the same using @ajax.beginform(). But i ended up with an error "Unexpected token u" in the console. Please help.
My class goes like this
public class Search
{
public string SearchText { get; set; }
public int ContinentId { get; set; }
public string City { get; set; }
}
My View goes like this
@model MvcApplication5.Models.BusinessLogic.Search
@{
ViewBag.Title = "Index";
var continetList = (SelectList)ViewBag.TargetContinentName;
var infoTypesList = (List<SelectListItem>)ViewBag.Infotype;
}
@Html.TextBoxFor(m => m.SearchText)<br/>
@Ajax.ActionLink("Search", "Search", "Home", new AjaxOptions{ HttpMethod = "POST", UpdateTargetId = "submitId", InsertionMode = InsertionMode.Replace,
LoadingElementId = "loadingId"})
</div>
My controller goes like this
//POST:/Home/
[HttpPost]
public PartialViewResult Search(Search search, int? page)
{
//Code goes here
//Here the object search is giving me null values for all the properties
return PartialView("_Search",listInfo);
}