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>

  • 相关阅读:
    【转】Android开发——MediaProvider源码分析(2)
    关于ActivityGroup使用过程中遇到的一点问题
    HttpWebRequest详解
    关于Assembly.CreateInstance()与Activator.CreateInstance()方法的区别
    你会在C#的类库中添加web service引用吗?
    ASP.NET跳转网页的三种方法的比较
    .net发送HTTP POST包
    依赖注入
    微软ASP.NET MVC Beta版本发布
    随笔~
  • 原文地址:https://www.cnblogs.com/wzh206/p/3165804.html
Copyright © 2011-2022 走看看