zoukankan      html  css  js  c++  java
  • AJAX enabled & disabled

    @model string
               
    @{
        ViewBag.Title = "GetPeople";
        AjaxOptions ajaxOpts = new AjaxOptions { UpdateTargetId = "tableBody", InsertionMode= InsertionMode.Replace,
                                                 Url = Url.Action("GetPeopleData") //确保javascript enable和disable时能正常显示
        };
    }
    <h2>
        GetPeople</h2>
    <table>
        <thead>
            <tr>
                <th>
                    First
                </th>
                <th>
                    Last
                </th>
                <th>
                    Role
                </th>
            </tr>
        </thead>
        <tbody id = "tableBody">
           @Html.Action("GetPeopleData", new { selectedRole = Model })
        </tbody>
    </table>

    @using(Ajax.BeginForm(ajaxOpts))
    {
        <div>
            @Html.DropDownList("selectedRole", new SelectList(
    new[] { "All" }.Concat(Enum.GetNames(typeof(Role)))))
            <button type="submit">
                Submit</button>
        </div>
    }

    <div>
        @foreach (string role in Enum.GetNames(typeof(Role)))
        {
            <div class="ajaxLink">
                @Ajax.ActionLink(role, "GetPeople",
          new { selectedRole = role },
          new AjaxOptions
          {
              UpdateTargetId = "tableBody",
              Url = Url.Action("GetPeopleData", new { selectedRole = role })
          })
            </div>
        }
    </div>

  • 相关阅读:
    java8新特性学习五(接口中的默认方法与静态方法)
    java8新特性学习四(Optional类)
    [record]WebLogic域之创建-文本界面
    [转]java 关于httpclient 请求https (如何绕过证书验证)
    数组与串,串的实现,KMP,BF算法
    git
    nginx设置重写规则
    深入PHP 第三章笔记
    进程和线程
    JS 获取 iframe内元素,及iframe与html调用
  • 原文地址:https://www.cnblogs.com/wzh206/p/3165804.html
Copyright © 2011-2022 走看看