Hi

I have a partial view, where my partial view will be called from Menu. When i call it, do server send only the partial view, or send all view (header, menus, footer)?

Recommended Answers

All 3 Replies

It realy depends on how you call your action. If it's a normal http get request it loads the layout + view + every partial.
If you want only the partial view to be retunred do an ajax call and replace the content with the result.

Actually, i want to select one to reduce bandwith consuming, either ajax or normal way.
I thought the server only returned the partial view, as there are 2 options when creating view, partial and using master page. As you told, normal http get request it loads all, so partial view is just for modularity.

thanks

Yep. If you worked with ASP.NET Webforms, partial views are the same as ascx files. They get loaded into the layout view (or master page in webforms).
If you want to save bandwith then go for ajax + partial view and replace the <div> (or whatever) on the master view (which is already loaded) with the new content

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.