asp.net mvc - Recommended way to reuse html server-side -


i thought using @html.partial calls other views on server side, before passing page user's browser...not asynchronously.

i have tiny views called in many views, example:

logo.cshtml:

<div ="logo">     <h2>this logo</h2>     <img src="logo.jpg"/> </div> 

wouldn't inefficient create async request small partial? there way reuse html server side, before passing rendered page user?

your question implies it's possible call views(partials) after page sent client (a single request here, not ajax), not possible.

html.partial(), html.renderpartial(), html.renderaction() , html.action() executed during streamwriter (networkwriter?) streaming content client. all 4 not async (as if called via async methods, rendering still on hold until calls complete, nullifying point of async). the difference between render , non-render action how content delivered stream..

as async not option, you're best options are:

for each view use html.renderpartial().

or more complex semi-nasty, barely better performance, call html.partial(), store (httpapplication... yeesh), , use cache. (really, don't this, make code terrible maintain).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -