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>

  • 相关阅读:
    华为花了100亿,为员工造了12个欧洲小镇,幸福到爆棚
    Qt5.9 官方发布的新版本亮点的确不胜枚举(而且修复2000+ bugs)
    详尽分析世纪之战:360VS腾讯是两个阶层的抗争
    c#
    PhantomJS
    bootstrap table
    Linux 入门
    多路搜索树
    网站性能优化工具
    NetCore上传多文件
  • 原文地址:https://www.cnblogs.com/wzh206/p/3165804.html
Copyright © 2011-2022 走看看