[Table] Difference between Html.RenderPartial and Html.Partial in MVC Razor

There are different ways to render a partial view in MVC Razor such as using the Html.RenderPartial, Html.Partial, Html.Renderaction and Html.action etc. In the following table you can see the difference between Html.RenderPartial and Html.Partial. Continue reading “[Table] Difference between Html.RenderPartial and Html.Partial in MVC Razor”

How to solve: Ajax.ActionLink shows partial view on entire page

If you trying to update the partial view with Ajax.ActionLink and instead of reloading the partial view within the view, it loads on entire web page or overwrites the view with the partial view’s content. Than you need to check the following things in your View and Partial View. Continue reading “How to solve: Ajax.ActionLink shows partial view on entire page”

Custom formatting of the columns in WebGrid MVC

The previous example will render all columns but you may want to limit which columns are displayed and how the style will be implement. First I’ll show you the rendering the numbers of selected columns, you can achieve this by passing the array of the columns in the WebGrid constructor. Continue reading “Custom formatting of the columns in WebGrid MVC”

Create Radio button List from the Model in MVC

Let’s suppose that we have a Model for the tbl_department and we want to render a radio button list for all departments. Take the following model as an example.

In the following article you will see that how to create a Radio button list in MVC. The article use the EmployeeDb sample SQL database( Download: scripts to create the EmlpoyeeDb SQL database) and MVC 4 framework with Razor engine view. Continue reading “Create Radio button List from the Model in MVC”

Convert MVC WebGrid data into JSON string and use it in controller

In this article I will demonstrates how to generate the JSON string from the WebGrid data in your MVC web application. In addition, you will learn how easy it is to use this JSON data in your controller. I assume that you have some basic knowledge of the MVC framework so I am not describing that how to start the MVC project from the scratch. Continue reading “Convert MVC WebGrid data into JSON string and use it in controller”