WebGrid 不在局部视图中刷新

WebGrid not refreshing inside Partial View

我在分部视图中有一个 WebGrid,如下所示:

<div class="box box-primary" id="gridSharedPractice">
    <div class="box-header with-border col-sm-12">
        <h3 class="box-title" id="PracticeAreasSharedHeading" name="ShareTemplateHeading">Practice Areas Shared </h3>
    </div>
<div class="box-body">
    <div id="PracticeGrid">
        @{
            var TestModel = Model.STAllPractice;
            var grid3 = new WebGrid(TestModel as IEnumerable<ASP_Upload_Version_1.Models.Share_Template>, canPage: false, canSort: false, ajaxUpdateContainerId: "PracticeGrid");
        }
    </div>

        @grid3.GetHtml(tableStyle: "table table-sm table-striped table-condensed",
                          htmlAttributes: new { @id = "GridSharedPractice", @class = "table table-sm table-striped table-bordered table-condensed", @style = "width:100%" },
                          columns: grid3.Columns(
                             grid3.Column("ShareID", "Share ID", null, "hidden-column"),
                             grid3.Column("TemplateName", "Template Name"),
                             grid3.Column("PracticeAreaAll", "Practice Area"),
                             grid3.Column(format: @<text>
                                    <a data-title="Are you sure to deactivate this Input?" onclick="DeleteRow(@item.ShareID)" class="delete"><i class="fa fa-trash" style="color:red"></i></a></text>, header: "Remove")));

</div>  
</div>

和 ajax 调用以从 webgrid 中删除任何行。

    function DeleteRow(ShareID) {
        $.ajax({
            url: '/ShareTemplate/UnShare/',
            data: "{ 'Type': 'Practice','ShareID': '" + ShareID + "'}",
            type: "POST",
            contentType: "application/json; charset=utf-8",
            success: function (data) {
                alert(data);
                $('#GridSharedPractice').html(data);                
                alert("disnt bind");
            },
            error: function (response) {
                //alert(response.responseText);
            },
            failure: function (response) {
                //alert(response.responseText);
            }
        });
    }

</script>

删除部分没问题,但是删除后,我无法刷新WebGrid。

分部视图在主视图中是这样调用的:

@{Html.RenderAction("PracticeGridPartialView", "ShareTemplate");}

您可以在 ajax 调用中使用它来加载局部视图

success: function (data) {
                $('#PartialGridsPractice').load('/<Controller>/<Action returning Partial View>');
            },