前端之家收集整理的这篇文章主要介绍了
MVC之DataTableFor和Ajax链接,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- @{
- ViewBag.Title = "基金主数据";
- }
-
- <h2>@ViewBag.Title</h2>
-
- <div class="listTitle">@Ajax.ModalDialogActionLink("新建基金...","New","Fund",null,"新建基金")</div>
-
- <script type="text/javascript">
- var oTable;
-
- function prepareServerParams(aoData) {
- $("#showDisabled").each(function() {
- aoData.push( { name: $(this).attr('id'),value: $(this).is(":checked") } );
- })
- }
- </script>
- @(Html.DataTableFor<FundListItem>("GetList","oTable","prepareServerParams"))
-
- <input type="checkBox" id="showDisabled" name="showDisabled" value="false" onclick="oTable.fnDraw()" />
- @Html.Label("showDisabled","显示禁用的基金",new { @class="checkBox",onClick="oTable.fnDraw()" })
-
- ----------------------
-
- @if (ViewData.Model.IsDisabled)
- {
- @Html.ActionLink("启用","ToggleIsDisabled",new { Code = ViewData.Model.Code })
- }
- else
- {
- @Html.ActionLink("禁用",new { Code = ViewData.Model.Code })
- }