Difference between Html.Partial() and Html.RenderPartial() in ASP.NET MVC
Html.Partial() | Html.RenderPartial() |
---|---|
Html.Partial returns html string | Html.RenderPartial returns void |
Html.Partial injects the html string of the partial view into the main view | Html.RenderPartial writes html in the response stream |
Html.Partial() need not to be inside the braces. | Html.RenderPartial must be inside braces @{ } |
Performance is slow. | Perform is faster compared with HtmlPartial() |
Use Partial when you have a model to send to the view and there will be a little bit of text that needs to be stored in a variable | Use RenderPartial when you have a model to send to the view and there will be a lot of html that doesn’t need to be stored in a variable |
SEE MORE
- Auto Refresh Partial View in ASP.NET MVC
- What is ASP.NET Core
- Difference between TempData keep() And Peek() in Asp.Net MVC
- Difference between viewbag,viewdata and tempdata in asp.net mvc
- ASP.NET MVC With AngularJS
- Retrieving Data Using Form Collection and Inserting Into ASP.Net MVC
- MVC CRUD Operations Using Entity Framework
- Search Functionality in ASP.NET MVC
- How to create a User Registration page using asp.net mvc
- Store Multiple Checkbox state from cookie using Jquery
- Cascading Dropdownlist using Ajax in Asp.Net Mvc with city state country
- Insert, Update, Delete In GridView Using ASP.Net C#
- Binding Dropdownlist With Database In Asp.Net MVC
- Search and Filter data in Gridview using Asp.net MVC
- Select Insert, Update And Delete With ASP.NET MVC
- Display Data in GridView Using Asp.net MVC
- Validation in ASP.NET MVC Razor view
- CRUD Operation Using 3-Tier Architecture In ASP.NET
- How to get Connection String from Web.Config in Asp.Net C#
- Login page using 3-Tier Architecture in ASP.Net
- Asp.Net Image Upload in 3-Tier Architecture and store in sql database
8 Comments