Here are the steps:

Step 1: Verify you have Microsoft jQuery Unobtrusive Ajax in your script folder,

jQuery Unobtrusive Ajax

If not then install package using the following command in Nuget:

Install-PackageMicrosoft.jQuery.Unobtrusive.Ajax

You may refer the following link to install.

Step 2: Create Controller, Model and View in your MVC application.

Step 3: Include the following two important script file in your project.

script file

Step 4: Create Partial view which you want to update in the Ajax.Begin form submit button. You may add this at the end of BeginForm,

fieldset

Step 5: Add Ajax.BeginForm.

It has the following parameters:
  1. Action Name
  2. Controller Name
  3. AjaxOption (mention HttpMethod =post , UpdateTargetId = “Traget Div to update”.

    AjaxOption

My Ajax.BegineForm is like the following:

Ajax.BegineForm

And My Final View is as below:

  1. @model DropdownGrid.Models.StudentDetailsModel
  2. @{
  3. ViewBag.Title = "Index";
  4. }
  5. < h2 >
  6. Index
  7. < /h2>
  8. < script type = "text/javascript"
  9. src = "@Url.Content("~/Scripts/jquery - 1.10.2. js ")" >
  10. < /script>
  11. < script type = "text/javascript"
  12. src = "@Url.Content("~/Scripts/jquery.unobtrusive - ajax.min.js ")" >
  13. < /script>
  14. < br >
  15. < br >
  16. < br >
  17. < br >
  18. < fieldset >
  19. < div id = "dvCategoryResults" >
  20. @
  21. {
  22. Html.RenderPartial("_PartialStudent", Model);
  23. }
  24. < /div>
  25. < /fieldset>
  26. < fieldset >
  27. @using(Ajax.BeginForm("CreateStudent", "GetStudents",
  28. new AjaxOptions
  29. {
  30. HttpMethod = "Post", UpdateTargetId = "dvCategoryResults"
  31. }))
  32. {
  33. < table >
  34. < tr >
  35. < td >
  36. @Html.LabelFor(M =>
  37. M.SelectedStudent.Id)
  38. < /td>
  39. < td >
  40. @Html.TextBoxFor(M =>
  41. M.SelectedStudent.Id)
  42. < td >
  43. < /tr>
  44. < tr >
  45. < td >
  46. @Html.LabelFor(M =>
  47. M.SelectedStudent.Name)
  48. < /td>
  49. < td >
  50. @Html.TextBoxFor(M =>
  51. M.SelectedStudent.Name)
  52. < td >
  53. < /tr>
  54. < tr >
  55. < td >
  56. @Html.LabelFor(M =>
  57. M.SelectedStudent.Address)
  58. < /td>
  59. < td >
  60. @Html.TextBoxFor(M =>
  61. M.SelectedStudent.Address)
  62. < td >
  63. < /tr>
  64. < tr >
  65. < td >
  66. @Html.LabelFor(M =>
  67. M.SelectedStudent.Class)
  68. < /td>
  69. < td >
  70. @Html.TextBoxFor(M =>
  71. M.SelectedStudent.Class)
  72. < td >
  73. < /tr>
  74. < tr >
  75. < td >
  76. @Html.LabelFor(M =>
  77. M.SelectedStudent.Section)
  78. < /td>
  79. < td >
  80. @Html.TextBoxFor(M =>
  81. M.SelectedStudent.Section)
  82. < td >
  83. < /tr>
  84. < /table>
  85. < input type = "submit"
  86. value = "Submit" / >
  87. }
  88. < /fieldset>
Hence you will get your div with partial view updates on submit button using Ajax.BeginForm.

index

On Submit button my partial view updates without postback.