@model PagedList<Lyxm.Entity.Suggestion>
@using Webdiyer.WebControls.Mvc

<div>
    <ul class="breadcrumb">
        <li>
            @Html.ActionLink("基础维护", "", "")
            <span class="divider">-</span>
        </li>
        <li>
            @Html.ActionLink("特色互动", "")
        </li>
    </ul>
</div>

<div class="row-fluid sortable">
    <div class="box span12">
        <form class="form-horizontal" method="post">
            @Html.AntiForgeryToken()
            @Html.ValidationSummary(true)
            <div class="box-header well" data-original-title>
                <h2><i class="icon-edit"></i>&nbsp;特色互动主题详情</h2>
                <div class="box-icon">
                </div>
            </div>
            <div class="box-content">

@*@Html.ValidationSummary(true)*@

<fieldset>
                    <legend>Suggestion</legend>

<div class="control-group">
                        <label class="control-label" for="typeahead">征集主题</label>
                        <div class="controls">
                            <input class="input-xlarge disabled" type="text" value="@ViewBag.SuggestionSubject.Title" disabled="" style="width:600px;">
                        </div>
                    </div>

<div class="control-group">
                        <div style="float: left;">
                            <label class="control-label" for="typeahead">作者</label>
                            <div class="controls">
                                <input class="input-xlarge disabled" type="text" value="@ViewBag.SuggestionSubject.Author" disabled="">
                            </div>
                        </div>
                        <div>
                            <label class="control-label" for="typeahead" style="margin-right: 20px;">征集部门</label>
                            <div class="controls">
                                <input class="input-xlarge disabled" type="text" value="@ViewBag.SuggestionSubject.Department" disabled="">
                            </div>
                        </div>
                    </div>

<div class="control-group">
                        <div style="float: left">
                            <label class="control-label" for="typeahead">截止时间</label>
                            <div class="controls">
                                <input class="input-xlarge disabled" type="text" value="@ViewBag.SuggestionSubject.BeginTime - @ViewBag.SuggestionSubject.EndTime" disabled="">
                            </div>
                        </div>
                        <div>
                            <label class="control-label" for="typeahead" style="margin-right: 20px;">发布</label>
                            <div class="controls">
                                <input class="input-xlarge disabled" type="checkbox" checked="@ViewBag.SuggestionSubject.Published" disabled="">
                            </div>
                        </div>
                    </div>

<div class="control-group">
                        <label class="control-label">正文</label>
                        <div class="controls">
                            <textarea id="Content" disabled="disabled">@ViewBag.SuggestionSubject.Content
                            </textarea>
                            @*@Html.TextArea(ViewBag.SuggestionSubject.Content, new { disabled = "" })*@
                        </div>
                    </div>
                </fieldset>

</div>

<div class="box-header well" data-original-title>
                <h2><i class="icon-edit"></i>&nbsp;特色互动回复列表</h2>
                <div class="box-icon">
                </div>
            </div>
            <div class="box-content">

<fieldset>
                    <legend>Suggestion</legend>

@foreach (var item in Model)
                    {
                        <div class="control-group">
                            <div style="float: left">
                                <label class="control-label" for="typeahead">@(Model.IndexOf(item) + 1)
                                    . 姓名</label>
                                <div class="controls">
                                    <input class="input-xlarge disabled" type="text" value="@item.Name" disabled="">
                                </div>
                            </div>
                            <div>
                                <label class="control-label" for="typeahead" style="margin-right: 20px;">电话</label>
                                <div class="controls">
                                    <input class="input-xlarge disabled" type="text" value="@item.Telephone" disabled="">
                                </div>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <div style="float: left">
                                <label class="control-label" for="typeahead">电子邮件</label>
                                <div class="controls">
                                    <input class="input-xlarge disabled" type="text" value="@item.Email" disabled="">
                                </div>
                            </div>
                            <div>
                                <label class="control-label" for="typeahead" style="margin-right: 20px;">发表时间</label>
                                <div class="controls">
                                    <input class="input-xlarge disabled" type="text" value="@item.AddDate" disabled="">
                                </div>
                            </div>
                        </div>
                        <div class="control-group">
                            <div style="float: left">
                                <label class="control-label" for="typeahead">是否通过审核</label>
                                <div class="controls">

<input class="input-xlarge disabled" type="text" value="@(item.Checked == true ? "审核通过" : "未通过")"  disabled="" style="width:60px; text-align:center;" />
                                    @*<input type="checkbox" name="inputChecked" value="@item.Checked.ToString()" />*@

&nbsp 通过 &nbsp<input id="@(Model.IndexOf(item))radioChecked" type="radio" name="@(Model.IndexOf(item))radioChecked" value="true"/>
                                    &nbsp 不通过 &nbsp<input id="@(Model.IndexOf(item))unradioChecked" type="radio" name="@(Model.IndexOf(item))radioChecked"  value="false"/>

@*原来的 @Html.Editor(item.Checked.ToString());
                                    @Html.ValidationMessage(item.Checked.ToString())*@
                                </div>
                            </div>
                        </div>
                        
                        <div class="control-group">
                            <label class="control-label">正文</label>
                            <div class="controls">
                                <textarea id="Content" class="input-xlarge disabled" rows="4" style="width: 600px;" disabled="disabled">@item.Content
                            </textarea>
                            </div>
                        </div>

}

<div class="row-fluid">
                        <div class="span12">
                            <div class="dataTables_info" id="DataTables_Table_0_info">显示 @Model.StartRecordIndex - @Model.EndRecordIndex 条,共 @Model.TotalItemCount 条</div>
                        </div>

<div class="span12 center">
                            <div class="dataTables_paginate paging_bootstrap pagination">
                                @Html.Pager(Model, new PagerOptions
                                   {
                                       PageIndexParameterName = "page",
                                       ContainerTagName = "ul",
                                       PagerItemWrapperFormatString = "<li>{0}</li>",
                                       CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a>{0}</a></li>",
                                       PagerItemsSeperator = ""
                                   })
                            </div>
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-success btn-large">保存</button>
                        <a href=" @Url.Action("Index")" class="btn btn-primary btn-large">返回列表</a>
                    </div>
                </fieldset>
            </div>

</form>
    </div>
</div>

@*增加编辑器js控件*@
@section featured {
    @Scripts.Render("~/bundles/jqueryval")
    <script src="~/Scripts/kindeditor-4.1.10/kindeditor.js"></script>
    <script src="~/Scripts/kindeditor-4.1.10/lang/zh_CN.js"></script>
    <script>
        KindEditor.ready(function (K) {
            window.editor = K.create('#Content', {
                width: '700px',
                height: '350px',
                uploadJson: '@Url.Action("UploadFile", "Upload")',
                allowFileManager: false
            });
            window.editor.readonly(true);
        });
    </script>
}

Controller

public ActionResult SuggestionIndex(int id, int? page, string search = "")
        {
            var subject = busi.GetSuggestionSubjectById(id);
            ViewBag.SuggestionSubject = subject;

int pageIndex = page ?? 1;
            if (!string.IsNullOrWhiteSpace(search))
            {
                if (!search.Equals(ViewBag.searchContent))
                {
                    pageIndex = 1;
                }
            }
            int pageSize = ManageSetting.PageSize;
            int skipCount = (pageIndex - 1) * pageSize;
            int total = 0;
            var atcs = busi.GetSuggestionList(id, pageIndex, pageSize, out total, search).ToPagedList(pageIndex, pageSize);
            atcs.CurrentPageIndex = pageIndex;
            atcs.TotalItemCount = total;

return View(atcs);
        }

//post Suggestion/SuggestionIndex/3?notice=修改成功!&page=1
        [HttpPost]
        [ValidateInput(false)]
        [ValidateAntiForgeryToken]
        public ActionResult SuggestionIndex(SuggestionSubject suggestionsubject,int?page,string search="")
        {

int pageIndex = page??1;
            if (!string.IsNullOrWhiteSpace(search))
            {
                if (!search.Equals(ViewBag.searchContent))
                {
                    pageIndex = 1;
                }
            }
            int pageSize = ManageSetting.PageSize;
            int skipCount = (pageIndex - 1) * pageSize;
            int total = 0;
            List<Suggestion> suggestionList = busi.GetSuggestionList(suggestionsubject.Id, pageIndex, pageSize, out total, search).ToPagedList(pageIndex, pageSize);

for (int i = 0; i < suggestionList.Count; i++)
            {
                if (!string.IsNullOrEmpty(Request.Form[i+"radioChecked"]))
                {
                    suggestionList[i].Checked = Convert.ToBoolean(Request.Form[i + "radioChecked"]);
                }
                else if (suggestionList[i].Checked == true)
                {
                    suggestionList[i].Checked = true;
                }
                else {
                    suggestionList[i].Checked = false;
                }

suggestionList[i].ModUserId = GetUserInfo().Id;
                busi.UpdateSuggestion(suggestionList[i]);

}
            return RedirectToAction("SuggestionIndex", new { id = suggestionsubject.Id, notice = Server.UrlEncode("修改成功!"), page = pageIndex });
        }

MVC 分页获取数据 及点选按钮的更多相关文章

  1. 腾讯云图片鉴黄集成到C# SQL Server 怎么在分页获取数据的同时获取到总记录数 sqlserver 操作数据表语句模板 .NET MVC后台发送post请求 百度api查询多个地址的经纬度的问题 try{}里有一个 return 语句,那么紧跟在这个 try 后的 finally {}里的 code 会 不会被执行,什么时候被执行,在 return 前还是后? js获取某个日期

    腾讯云图片鉴黄集成到C#   官方文档:https://cloud.tencent.com/document/product/641/12422 请求官方API及签名的生成代码如下: public c ...

  2. SQL Server 怎么在分页获取数据的同时获取到总记录数

    SQL Server 获取数据的总记录数,有两种方式: 1.先分页获取数据,然后再查询一遍数据库获取到总数量 2.使用count(1) over()获取总记录数量 SELECT * FROM ( SE ...

  3. redis分页获取数据

    php代码: 采用哈希类型存储数据,有序集合存储分页数据,进行倒序与正序的排序. $getGoodsInfo = M('goods_test')->select(); for($i=0;$i&l ...

  4. php表单中如何获取单选按钮与复选按钮的值(示例)

    转载:http://www.php.cn/php-weizijiaocheng-360027.html php代码中获取表单中单选按钮的值:(单选按钮只能让我们选择一个,这里有一个“checked”属 ...

  5. tp5 使用paginate分页获取数据对象之后 如何对对象进行数据添加

    tp5 使用paginate分页获取数据对象之后 如何对对象进行数据添加 大家都知道,在使用tp5的paginate获取分页数据之后,得到的是一个数据对象,但有时会碰到要对数据对象进行二次加工的情况, ...

  6. MVC后台获取数据和插入数据的三种方式【二】

    MVC模式下,从前端获取数据返回后台,总共有三种形式.下面的代码示例将演示如何将数据返回到后端. 一.首先我们看看表单代码,注意input标签中name的值. <html> <hea ...

  7. MVC—实现ajax+mvc异步获取数据

    之前写过ajax和一般处理程序的结合实现前后台的数据交换的博客,如今做系统用到了MVC,同一时候也用到了异步获取数据. ajax+一般处理程序与MVC+ajax原理是一样的在"URL&quo ...

  8. 【Django+Element UI】使用一个接口文件,搞定分页获取数据,模糊查询后分页获取数据

    1:序列化获取数据的接口设计 1:分页获取序列化数据 2:是个能传参数的接口 class Society(APIView): def post(self, request): keywords = s ...

  9. NHibernte 4.0.3版本中,使用Queryover().Where().OrderBy().Skip().Take()方法分页获取数据失败

    问题代码如下: var result=repository.QueryOver<modal>() .Where(p=>p.Code==Code) .OrderBy(p=>p.I ...

随机推荐

  1. google浏览器翻译失败解决方案

    用记事本打开 C:\Windows\System32\drivers\etc下hosts文件 在文件末尾加入如下两行 203.208.46.145 translate.google.com 203.2 ...

  2. Effective Java从零开始 - 就是爱Java

    或许你已经开始写Java了,或许只是想要一窥这个的世界,无论是抱着何种心情来看Java,从零开始,会一种没有负担,没有包袱的事,你会发现写程序不再是枯燥乏味,孤单寂寞的一个人,而是生活中最快乐的学习之 ...

  3. usb开发笔记

    U盘应属于海量存储类. USB海量存储设备,又包括通用海量存储子类,CDROM,Tape等,U盘实际上属于海量存储类中通用海量存储子类.通用海量存储设备实现上是基于块/扇区存储的设备. USB组织定义 ...

  4. RegexOptions枚举

    在创建Regex类的实例时,构造函数的重载中有一个要求传入RegexOptions的一个枚举值,我相信这个枚举一定非常有用,否则不会要求在构造函数中传入.今天就来看一看这个枚举的作用. 我们干脆把代码 ...

  5. 前台利用jcrop做头像选择预览,后台通过django利用Uploadify组件上传图最终使用PIL做图像裁切

    之前一直使用python的PIL自定义裁切图片,今天有需求需要做一个前端的选择预览页面,索性就把这个功能整理一下,分享给大家. 实现思路: 1.前端页面: 用户选择本地一张图片,然后通过鼠标缩放和移动 ...

  6. Asp.Net的核心对象

    原文地址:http://www.cnblogs.com/fish-li/archive/2011/08/21/2148640.html 1.HttpRuntime 对象在处理Http请求的asp.ne ...

  7. 精美的 ( Android, iPhone, iPad ) 手机界面设计素材和线框图设计工具

    在制作界面原型的时候,如果有现成的界面基础元素可以使用的话,设计师就可以非常快速的完成原型的制作,能够节省大量的时间和精力.在这篇文章, 我向大家分享45套非常有用的 UI 和 Wireframe 套 ...

  8. UESTC_邱老师的脑残粉 2015 UESTC Training for Graph Theory<Problem D>

    D - 邱老师的脑残粉 Time Limit: 12000/4000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Sub ...

  9. ZOJ3574(归并排序求逆数对)

    Under Attack II Time Limit: 5 Seconds      Memory Limit: 65536 KB Because of the sucessfully calcula ...

  10. Python列表及元组

    列表(list)是Python以及其他语言中最常用到的数据结构之一.Python使用使用中括号[ ] 来解析列表.列表是可变的(mutable)——可以改变列表的内容. 如 list1 = ['phy ...