单击下一页时如何避免丢失第一页文本框的值 - webgrid

时间:2014-02-28 10:56:42

标签: jquery asp.net-mvc asp.net-mvc-4 webgrid

ASP.NET MVC 4 and C# - 我需要知道在点击下一页时如何避免刷新webgrid页面而不会丢失textbox(txtMessage)的值。我的问题是,当我在第一页的某些消息textbox中输入值,然后单击下一页并返回第一页时,值就消失了。 无论您点击下一页或返回的时间如何,如何保持价值。我一直在尝试在Google上找到解决方案,但我失去了如何解决它。

@{

Layout = "~/Views/Shared/_Layout.cshtml";
var grid = new WebGrid(Model, rowsPerPage: 100, ajaxUpdateContainerId: "gridcontent");
 }

  <div id="gridcontent" >

    @grid.GetWebGrid(
    htmlAttributes: new { id = "grid" },
    tableStyle: "grid",
    headerStyle: "grid-header",
    footerStyle: "grid-footer",
    selectedRowStyle: "rid-selected-row",
    alternatingRowStyle:"grid-alternating-row",
    rowStyle: "grid-row-style",
    mode: WebGridPagerModes.FirstLast | WebGridPagerModes.Numeric | WebGridPagerModes.NextPrevious,
    numericLinksCount: 5,
    firstText: "<< First",
    previousText: "< Previous",
    lastText: "Last >>",
    nextText: "Next >",
    columns: grid.Columns(
                grid.Column(columnName: "AnimalId", header: "Animal ID", style: "colId", format: (item) => string.IsNullOrEmpty(item.AnimalId) ? string.Empty : item.AnimalId),
        grid.Column(columnName: "MessageValue", header: "Message", format: (item) => Html.TextBox("txtMessage", (object)item.MessageValue), canSort: false,),

             grid.Column(header: "View Details", format: @<text><input id="btnView " type="button" value="Details" /></text>),
              ))

  </div>

0 个答案:

没有答案