Webgrid刷新数据

时间:2019-03-31 16:57:08

标签: webgrid

我正在尝试刷新Webgrid控件上的数据。 我正在使用location.reload(),但它只会刷新整个页面,并且网格不会显示任何数据。 如何在不刷新页面的情况下刷新网格?

代码:

function loadGridDumas(id) {
        $.ajax({
            url: '@Url.Action("Dumas/GetObroci")',
            type: 'GET',
            dataType: 'html',
            data: { odjel: id },
            success: function (data) {
                location.reload();                
            },
            error: function (xmlHttpRequest, textStatus, errorThrown) { showError(xmlHttpRequest.responseText); }
            })
        }

<div id="gridDumas">
    @{
        WebGrid grid = new WebGrid(gridData, selectionFieldName: "selectedRow", ajaxUpdateContainerId: "gridDumas");
        grid.Pager(WebGridPagerModes.All);}   


        @grid.GetHtml(tableStyle: "gTable",
        columns: grid.Columns(grid.Column(header: " ",
                format: @<text><img src="@Url.Content("../../Content/images/add.png")"
                                    style="cursor: pointer" onclick="return PopupAddMeal(this); return false;"
                                    alt="Add" title="Dumas - Add" /></text>),
                        @*grid.Column(header: " ",
                            format: @<text><img src="@Url.Content("../../Content/images/edit.png")"
                                                style="cursor: pointer" onclick="return GetSelectedRow(this); return false;"
                                                alt="Edit" title="Dumas - Edit" /></text>),*@
                        grid.Column(header: " ",
                            format: @<text><img src="@Url.Content("../../Content/images/delete.png")"
                                                style="cursor: pointer" onclick="return DeleteMeal(this); return false;"
                                                alt="Delete" title="Dumas - Delete" /></text>),
                                                                  grid.Column("Pin", "Pin"),
                                                                  grid.Column("Name", "Ime"),
                                                                  grid.Column("Surname", "Prezime"),
                                                    grid.Column("M4Cijena", "M4 Cijena"),
                                                                  grid.Column("UkupnoM1_M2", "Ukupno M1_M2"),
                                                                  grid.Column("UkupnoM3_M4", "Ukupno M3_M4"),
                                                                  grid.Column("KN_Sinc", "KN_Sinc"),
                                                                  grid.Column("KN_Radnik", "KN_Radnik")
                                                                  ))

    </div>

0 个答案:

没有答案