javascript - ASP.net Razor Refresh on partial view returns to home page -


i using ajax call controllers render partial views. everytime hit refresh button or button returns homepage/index instead of partial view page being displayed. know solution?

there few ways handle this, 1 have partial view add hash or querystring url, , have handling in javascript or controller know how grab hash/querystring , load right partial view on page reload.

but if need keep track of doing before hitting reload, either use holding location server-side, or caching client-side. tips on caching, @ this or this.

i found both work equally well, going hash or querystring show in url, not going for.

edit

i'm not sure frameworks using on client-side (knockout.js, jquery, etc.) lot of these make stuff easier, create simple cache of views on load, adding needed views cache based on whatever order need them, , inject div or when call it.

the issue here, partial views code snippits in way, server knows how dish them up, , client knows how view them, browser doesn't view them entries browser history have tell browser how ensure data gets reloaded how want.

another option @ injecting them browser history, still need way server dish right partial on load. found here on guy's implementation of loading partials single-page web applications, seemed option. again, need know how going dish data on reload. answer comment, there isn't magical way browser know calling ajax. if want browser know automatically, try using @html.partial(string partialviewname) or @html.renderpartial(string partialviewname) see msdn on these.

you putting in viewdata, tempdata, viewbag, or session data @ this article on differences, see if 1 work needs.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -