abcdef133 发表于 2008-10-31 15:19:36

Asp.net Mvc Pv4中使用AjaxHelper

这个有点类似于UpdatePanel,首先要引用2个js一个是Microsoft Ajax Lib,一个是Mvc的Ajax新类

以下为引用的内容:
      CODE:
      <script src="/Content/MicrosoftAjax.js" type="text/javascript"></script>
      <script src="/Content/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>


使用方法1

以下为引用的内容:
         <%using (Ajax.Form("About", new AjaxOptions() {UpdateTargetId = "showdiv"})) { %>
      <%=Html.SubmitButton() %>
      <div id="showdiv"></div>
      <%} %>



这样就将其中的About这个Action显示在 了showdiv中

使用方法2

以下为引用的内容:
    <%=Ajax.ActionLink("显示", "About", new AjaxOptions() {      UpdateTargetId = "showdiv"})%>



这样就可以通过一个连接直接显示了。
页: [1]
查看完整版本: Asp.net Mvc Pv4中使用AjaxHelper

网站推广