Recently I started working on ASP.NET MVC3 with the Razor view engine. Initially had to face some difficulty with lack of knowledge about Razor view engine and then I managed to handle things smoothly. I came across an issue when implementing a simple AJAX post back form where I needed to show my submitted results in a grid view without user to experiencing a post back in the same page. I created a partial view for my input data form and included in the Index page using @Html.RenderPartial. Then I created an Ajax.BeginForm block and moved my partial view into AJAX block. AJAX post back was successful but every time it returns a whole page into my UpdateTargetId which is a DIV.
After doing couple of hours of R&D I was able come up with the following solution and it is working fine.
Solution
I created another partial view for my grid and placed in the Index page. Now my index page markup looks like below.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEillkN5rz8hOOL0YHAyQoohZpMTh6QDYCagSS6COlqE9SV-QCoplJD3A0qZkbqaVIOJvIOCjpysg_mOHlUZxy3CVIakvDiYgxe2KP97tZ2-R0-87-UM4f_bIqeq2lOn2uAVyp7tVhIuC3L9/s400/index+markup.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEillkN5rz8hOOL0YHAyQoohZpMTh6QDYCagSS6COlqE9SV-QCoplJD3A0qZkbqaVIOJvIOCjpysg_mOHlUZxy3CVIakvDiYgxe2KP97tZ2-R0-87-UM4f_bIqeq2lOn2uAVyp7tVhIuC3L9/s400/index+markup.jpg)
Finally my page looks like as follows.
You can download the complete source code here