28
Reply

What is the difference between view an partial view in mvc 4

Kowsalya devi

Kowsalya devi

11y
16.2k
1
Reply

    partial view() is Reusable view.but view() is a single page means which will render a normal .aspx page

    Partial view is similar to ascx in asp.net i.e- usercontrol where as View is a whole cshtml page

    View can basically contains a complete markup which may contain a master view(or master page) with all the design(s) etc. whereas Partial view is only a portion of page or a small markup which don't have master page. It is basically used as user control in mvc and it can be used at more than one views.

    View:It means only one view in page. Partial View:It means one view with different views or coloumns

    Returning a View() will render a normal .aspx page that can also consist of Partial Views, while returning PartialView() will render an .ascx control (Basically a portion of HTML that can be requested through AJAX requests).return View(); //Returns a fully-featured HTML page with associated headers etc.return PartialView(); //Returns a portion of HTML that can be called via AJAX requests. However - if you are using the Razor View Engine, there will not be a major difference between the two. You could have a specific View that could be rendered as either a Partial View or as a traditional View, the difference would be if you used View or PartialView to call it.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    it does not contain html body.

    A partial view is a "sub-view" that you embed within a main view - something that you might reuse across multiple views, like a sidebar

    View have layout , But partial view not have

    best article i have found on this is http://completedevelopment.blogspot.com/2014/01/is-there-really-no-difference-between.html