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>

  • 相关阅读:
    vertical-align
    剑指offer刷题
    ES6 promise
    wangyi准备
    spring定时器
    xshell下linux常用操作
    HSSFWorkbook生成excel文件
    梳理并分解继承体系
    JSON格式数据转换
    部署项目
  • 原文地址:https://www.cnblogs.com/wzh206/p/3165804.html
Copyright © 2011-2022 走看看