一个MVC HTML帮助器以异步加载部分视图

  • F2_533613
    了解作者
  • 106.2KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-05-26 22:36
    上传日期
通过异步自动加载部分视图来加快主视图的加载速度
1206368.zip
  • LogOn.aspx?rp=%2FKB%2Faspnet%2F1206368%2FMvcPartialAsyncDemo_VS2015.zip&download=true
    52.2KB
  • An-MVC-HTML-Helper-to-Asynchronously-Load-Partial.pdf
    97KB
内容介绍
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta charset="utf-8"><meta name="generator" content="pdf2htmlEX"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><link rel="stylesheet" href="https://csdnimg.cn/release/download_crawler_static/css/base.min.css"><link rel="stylesheet" href="https://csdnimg.cn/release/download_crawler_static/css/fancy.min.css"><link rel="stylesheet" href="https://csdnimg.cn/release/download_crawler_static/16513002/raw.css"><script src="https://csdnimg.cn/release/download_crawler_static/js/compatibility.min.js"></script><script src="https://csdnimg.cn/release/download_crawler_static/js/pdf2htmlEX.min.js"></script><script>try{pdf2htmlEX.defaultViewer = new pdf2htmlEX.Viewer({});}catch(e){}</script><title></title></head><body><div id="sidebar" style="display: none"><div id="outline"></div></div><div id="pf1" class="pf w0 h0" data-page-no="1"><div class="pc pc1 w0 h0"><img class="bi x0 y0 w1 h1" alt="" src="https://csdnimg.cn/release/download_crawler_static/16513002/bg1.jpg"><div class="c x1 y1 w2 h2"><div class="t m0 x2 h3 y2 ff1 fs0 fc0 sc0 ls0 ws0">&#19968;&#20010;<span class="_ _0"></span>&#19968;&#20010;<span class="_ _1"></span><span class="ff2">MVC<span class="_ _2"></span> HTM<span class="_ _2"></span>L</span>&#24110;<span class="_ _2"></span>&#21161;&#22120;<span class="_ _2"></span>&#20197;&#24322;&#27493;<span class="_ _2"></span>&#21152;&#36733;<span class="_ _2"></span>&#37096;&#20998;<span class="_ _2"></span>&#35270;&#22270;<span class="_ _3"></span>&#24110;&#21161;<span class="_ _2"></span>&#22120;&#20197;<span class="_ _2"></span>&#24322;&#27493;<span class="_ _2"></span>&#21152;&#36733;&#37096;<span class="_ _2"></span>&#20998;&#35270;<span class="_ _2"></span>&#22270;</div><div class="t m0 x2 h4 y3 ff1 fs1 fc0 sc0 ls0 ws0">&#20171;&#32461;<span class="_ _4"></span>&#20171;&#32461;</div><div class="t m0 x2 h5 y4 ff1 fs2 fc0 sc0 ls0 ws0">&#26377;&#26102;&#65292;&#32034;<span class="_ _2"></span>&#24341;&#39029;&#30340;&#21152;<span class="_ _2"></span>&#36733;&#26102;&#38388;&#21487;<span class="_ _2"></span>&#33021;&#22826;&#38271;&#65292;&#36890;<span class="_ _2"></span>&#24120;&#26159;&#22240;&#20026;<span class="_ _2"></span>&#25152;&#38656;&#30340;&#25968;<span class="_ _2"></span>&#25454;&#26469;&#33258;&#38271;&#26102;<span class="_ _2"></span>&#38388;&#36816;&#34892;&#30340;<span class="_ _2"></span>&#36827;&#31243;&#25110;&#36164;<span class="_ _2"></span>&#28304;&#32531;&#24930;&#65288;<span class="_ _2"></span><span class="ff3">DB</span>&#32531;&#24930;&#65292;<span class="_ _2"></span><span class="ff3">Web</span>&#26381;&#21153;&#24310;<span class="_ _2"></span>&#36831;&#65292;&#29305;</div><div class="t m0 x2 h5 y5 ff1 fs2 fc0 sc0 ls0 ws0">&#23450;&#25968;&#25454;&#35745;<span class="_ _2"></span>&#31639;&#31561;&#65289;&#12290;</div><div class="t m0 x2 h5 y6 ff1 fs2 fc0 sc0 ls0 ws0">&#24403;&#28982;&#65292;&#39318;<span class="_ _2"></span>&#20808;&#35201;&#20570;&#30340;<span class="_ _2"></span>&#26159;&#23581;&#35797;&#36890;<span class="_ _2"></span>&#36807;&#25968;&#25454;&#24211;&#20248;<span class="_ _2"></span>&#21270;&#65292;&#20195;&#30721;<span class="_ _2"></span>&#23457;&#26597;&#65292;&#25968;<span class="_ _2"></span>&#25454;&#20998;&#39029;&#31561;&#26041;<span class="_ _2"></span>&#24335;&#28165;&#38500;&#36825;<span class="_ _2"></span>&#20123;&#38382;&#39064;&#12290;<span class="_ _2"></span><span class="ff3"> <span class="_ _5"></span><span class="ff1">&#20294;&#26159;&#65292;&#20316;<span class="_ _2"></span>&#20026;&#26368;&#21518;&#30340;<span class="_ _2"></span>&#26426;&#20250;&#65292;&#35201;<span class="_ _2"></span>&#25913;&#21892;&#29992;&#25143;</span></span></div><div class="t m0 x2 h5 y7 ff1 fs2 fc0 sc0 ls0 ws0">&#22312;&#27983;&#35272;&#22120;<span class="_ _2"></span>&#21069;&#31561;&#24453;&#30340;<span class="_ _2"></span>&#20307;&#39564;&#65292;&#25105;<span class="_ _2"></span>&#20204;&#21487;&#20197;&#20570;&#30340;<span class="_ _2"></span>&#23601;&#26159;&#23613;&#24555;<span class="_ _2"></span>&#20026;&#20182;&#25552;&#20379;<span class="_ _2"></span>&#19968;&#20123;&#19996;&#35199;&#65292;<span class="_ _2"></span>&#24182;&#22312;&#26377;&#25968;<span class="_ _2"></span>&#25454;&#26102;&#23613;&#24555;<span class="_ _2"></span>&#23436;&#25104;&#39029;&#38754;<span class="_ _2"></span>&#12290;</div><div class="t m0 x2 h4 y8 ff1 fs1 fc0 sc0 ls0 ws0">&#37096;&#20998;&#35270;<span class="_ _2"></span>&#22270;&#21644;<span class="_ _6"></span>&#37096;&#20998;&#35270;<span class="_ _2"></span>&#22270;&#21644;<span class="_ _1"></span><span class="ff2">HtmlHelp<span class="_ _2"></span>er</span>&#25193;&#23637;<span class="_ _2"></span>&#26041;&#27861;<span class="_ _7"></span>&#25193;&#23637;&#26041;<span class="_ _2"></span>&#27861;</div><div class="t m0 x2 h5 y9 ff1 fs2 fc0 sc0 ls0 ws0">&#27599;&#20010;&#20154;&#37117;<span class="_ _2"></span>&#30693;&#36947;&#24182;&#20351;<span class="_ _2"></span>&#29992;<span class="ff3">MVC</span>&#20013;<span class="_ _2"></span>&#30340;&#23616;&#37096;&#35270;&#22270;<span class="_ _2"></span>&#65292;&#20197;&#21450;&#23616;<span class="_ _2"></span>&#37096;&#35270;&#22270;&#22914;<span class="_ _2"></span>&#20309;&#21253;&#21547;&#22312;<span class="_ _2"></span>&#20027;<span class="_ _2"></span><span class="ff3 fs3">View<span class="fs2"> </span></span>&#65288;&#36890;&#24120;&#26159;<span class="_ _2"></span>&#32034;&#24341;&#39029;&#65289;<span class="_ _2"></span>&#20013;&#12290;</div><div class="t m0 x2 h5 ya ff1 fs2 fc0 sc0 ls0 ws0">&#27492;&#25193;&#23637;&#26159;<span class="_ _2"></span>&#19968;&#20010;&#26032;&#30340;<span class="_ _2"></span><span class="ff3 fs3">HtmlHelper<span class="_ _2"></span></span>&#24037;&#20316;&#24456;&#33039;&#65292;<span class="_ _2"></span>&#21363;&#26174;&#31034;<span class="ff3">&#8220;</span>&#39044;<span class="_ _2"></span>&#35272;<span class="ff3">&#8221;</span>&#23616;&#37096;&#35270;<span class="_ _2"></span>&#22270;&#65292;&#22312;&#24149;<span class="_ _2"></span>&#21518;&#35843;&#29992;&#30495;<span class="_ _2"></span>&#23454;&#35270;&#22270;&#65292;&#26368;<span class="_ _2"></span>&#21518;&#31435;&#21363;&#20934;<span class="_ _2"></span>&#22791;&#23601;&#32490;&#26102;<span class="_ _2"></span>&#26174;&#31034;&#23436;&#25972;<span class="_ _2"></span>&#29256;&#26412;&#65292;&#21487;</div><div class="t m0 x2 h5 yb ff1 fs2 fc0 sc0 ls0 ws0">&#33021;&#21482;&#29992;&#19968;<span class="_ _2"></span>&#34892;&#20195;&#30721;&#35843;<span class="_ _2"></span>&#29992;&#23427;&#12290;</div><div class="t m0 x2 h4 yc ff1 fs1 fc0 sc0 ls0 ws0">&#20351;&#29992;&#20195;<span class="_ _2"></span>&#30721;<span class="_ _7"></span>&#20351;&#29992;&#20195;<span class="_ _2"></span>&#30721;</div><div class="t m0 x2 h5 yd ff3 fs2 fc0 sc0 ls0 ws0">C<span class="ff1">&#65283;</span></div><div class="t m0 x2 h6 ye ff3 fs3 fc0 sc0 ls0 ws0">@Html.Asy<span class="_ _2"></span>ncPartial( <span class="_ _2"></span>"<span class="_ _2"></span> <span class="_ _2"></span>MyController" , <span class="_ _2"></span>" <span class="_ _2"></span>MyAc<span class="_ _2"></span>tion" )</div><div class="t m0 x2 h5 yf ff1 fs2 fc0 sc0 ls0 ws0">&#36825;&#26159;&#20195;&#26367;<span class="_ _2"></span><span class="ff3 fs3">Html.Partial</span>&#30340;<span class="_ _2"></span>&#25193;&#23637;&#30340;&#26368;&#31616;<span class="_ _2"></span>&#21333;&#29992;&#27861;&#65292;<span class="_ _2"></span>&#23427;&#23558;&#25552;&#20379;<span class="_ _2"></span>&#32473;&#65306;</div><div class="t m0 x1 h5 y10 ff1 fs2 fc0 sc0 ls0 ws0">&#30452;&#25509;&#22312;&#29238;<span class="_ _2"></span>&#35270;&#22270;&#20013;&#21152;<span class="_ _2"></span>&#36733;&#22312;&#36825;&#31181;<span class="_ _2"></span>&#24773;&#20917;&#19979;&#21517;&#20026;<span class="_ _2"></span><span class="ff3">&#8220; <span class="_ _5"></span><span class="fs3">MyAction_Previe<span class="_ _2"></span>w<span class="fs2"> &#8221;<span class="ff1">&#30340;&#37096;<span class="_ _2"></span>&#20998;&#35270;&#22270;&#65292;<span class="_ _2"></span>&#35813;&#37096;&#20998;&#36890;&#24120;<span class="_ _2"></span>&#26159;&#26080;&#27169;&#22411;<span class="_ _2"></span>&#30340;&#37096;&#20998;&#35270;<span class="_ _2"></span>&#22270;&#12290;<span class="_ _5"></span><span class="ff3"> <span class="_ _5"></span><span class="ff1">&#23427;&#30340;&#22806;&#35266;<span class="_ _2"></span>&#24212;&#19982;</span></span></span></span></span></span></div><div class="t m0 x1 h5 y11 ff1 fs2 fc0 sc0 ls0 ws0">&#26368;&#32456;&#35270;&#22270;<span class="_ _2"></span>&#30456;&#20284;&#65292;&#20294;<span class="_ _2"></span>&#20165;&#26174;&#31034;&#19968;<span class="_ _2"></span>&#20010;&#27491;&#22312;&#31561;&#24453;<span class="_ _2"></span>&#30340;&#24494;&#35843;&#22120;<span class="_ _2"></span>&#25110;&#24744;&#21916;&#27426;<span class="_ _2"></span>&#30340;&#20869;&#23481;&#12290;</div><div class="t m0 x1 h5 y12 ff1 fs2 fc0 sc0 ls0 ws0">&#23558;&#39044;&#35272;&#37096;<span class="_ _2"></span>&#20998;<span class="ff3">HTML</span>&#21253;<span class="_ _2"></span>&#35013;&#21040;&#23481;&#22120;<span class="_ _2"></span>&#20013;&#65292;&#24182;&#20316;<span class="_ _2"></span>&#20026;&#20869;&#32852;&#20195;<span class="_ _2"></span>&#30721;&#25110;&#25105;&#20204;&#20915;<span class="_ _2"></span>&#23450;&#30340;&#22320;&#26041;<span class="_ _2"></span>&#27880;&#20837;&#23558;&#35843;<span class="_ _2"></span>&#29992;<span class="_ _2"></span><span class="ff3 fs3">MyController<span class="_ _2"></span>/Myaction<span class="fs2">JavaS<span class="_ _2"></span>cript</span></span>&#20195;&#30721;</div><div class="t m0 x1 h5 y13 ff1 fs2 fc0 sc0 ls0 ws0">&#29992;<span class="ff3">JavaS<span class="_ _2"></span>cript</span>&#33719;&#24471;&#30340;<span class="_ _2"></span>&#24322;&#27493;&#21709;&#24212;<span class="_ _2"></span>&#26367;&#25442;&#23481;&#22120;&#20869;<span class="_ _2"></span>&#23481;</div><div class="t m0 x2 h5 y14 ff1 fs2 fc0 sc0 ls0 ws0">&#32467;&#26524;&#26159;&#39044;<span class="_ _2"></span>&#35272;<span class="ff3">Partial</span>&#35270;<span class="_ _2"></span>&#22270;<span class="ff3">...</span></div><div class="t m0 x2 h5 y15 ff3 fs2 fc0 sc0 ls0 ws0">...<span class="ff1">&#19968;&#26086;&#26377;<span class="_ _2"></span>&#25968;&#25454;&#65292;&#23558;&#30001;<span class="_ _2"></span>&#23436;&#25972;&#30340;</span>&#8220;<span class="ff1">&#37096;<span class="_ _2"></span>&#20998;&#35270;&#22270;</span>&#8221;<span class="ff1">&#26367;<span class="_ _2"></span>&#25442;&#12290;</span></div><div class="t m0 x2 h5 y16 ff1 fs2 fc0 sc0 ls0 ws0">&#23436;&#25972;&#30340;&#25193;<span class="_ _2"></span>&#23637;&#31614;&#21517;&#22914;<span class="_ _2"></span>&#19979;&#65306;</div><div class="t m0 x2 h5 y17 ff3 fs2 fc0 sc0 ls0 ws0">C<span class="ff1">&#65283;</span></div><div class="t m0 x2 h6 y18 ff3 fs3 fc0 sc0 ls0 ws0"> p<span class="_ _2"></span>ublic <span class="_ _2"></span>static MvcHtmlStr<span class="_ _2"></span>ing AsyncParti<span class="_ _2"></span>al( this HtmlH<span class="_ _2"></span>elper helper,</div><div class="t m0 x2 h6 y19 ff3 fs3 fc0 sc0 ls0 ws0"> string<span class="_ _2"></span> controller,</div><div class="t m0 x2 h6 y1a ff3 fs3 fc0 sc0 ls0 ws0"> string<span class="_ _2"></span> action,</div><div class="t m0 x2 h6 y1b ff3 fs3 fc0 sc0 ls0 ws0"> string<span class="_ _2"></span> previewPar<span class="_ _2"></span>tialName= nul<span class="_ _2"></span>l ,</div><div class="t m0 x2 h6 y1c ff3 fs3 fc0 sc0 ls0 ws0"> AjaxMet<span class="_ _2"></span>hods method =<span class="_ _2"></span> AjaxMethods.G<span class="_ _2"></span>ET,</div><div class="t m0 x2 h6 y1d ff3 fs3 fc0 sc0 ls0 ws0"> TempDa<span class="_ _2"></span>taDictionary T<span class="_ _2"></span>empData= <span class="_ _2"></span>null )</div><div class="t m0 x2 h5 y1e ff3 fs3 fc0 sc0 ls0 ws0">previewPar<span class="_ _2"></span>tialName<span class="fs2"> <span class="ff1">&#65306;&#22914;&#26524;<span class="_ _2"></span>&#25552;&#20379;&#65292;&#23427;<span class="_ _2"></span>&#23558;&#26159;&#22312;&#31561;&#24453;<span class="_ _2"></span>&#24322;&#27493;&#35843;&#29992;<span class="_ _2"></span>&#23436;&#25104;&#26102;&#26174;<span class="_ _2"></span>&#31034;&#30340;</span>&#8220; previ<span class="_ _2"></span>ew&#8221;<span class="ff1">&#23616;&#37096;&#35270;<span class="_ _2"></span>&#22270;&#30340;&#21517;&#31216;<span class="_ _2"></span>&#12290;<span class="_ _8"></span><span class="ff3"> <span class="ff1">&#40664;&#35748;&#20026;</span>&#8220; <span class="_ _5"></span><span class="fs3">{action}_preview<span class="fs2"> &#8221;</span></span></span></span></span></div></div></div><div class="pi" data-data='{"ctm":[1.611639,0.000000,0.000000,1.611639,0.000000,0.000000]}'></div></div></body></html>
评论
    相关推荐