C# 页面标题显示两次

C# 页面标题显示两次,c#,ajax,razor,asp.net-mvc-5,C#,Ajax,Razor,Asp.net Mvc 5,我有一个奇怪的问题,当我更改显示的结果数量时,页面标题显示了两次 主视图 //添加了@{&join viewbag关键字 @{ ViewBag.Title = "Societies & Proxies"; } @section scripts { <script language="javascript" type="text/javascript"> @* DOM ready? *@ $(function () { addT

我有一个奇怪的问题,当我更改显示的结果数量时,页面标题显示了两次

主视图 //添加了@{&join viewbag关键字

@{
    ViewBag.Title = "Societies & Proxies";
}

@section scripts {
    <script language="javascript" type="text/javascript">
    @* DOM ready? *@
    $(function () {
        addTableStylingScripts();

        @* Pagination Async Partial Handling *@
        $(document).on("click",
            "#indexPager a",
            function() {
                if ($(this).parent().hasClass('disabled') || $(this).parent().hasClass('active'))
                    return false;
                $.ajax({
                    url: $(this).attr("href"),
                    type: 'GET',
                    cache: false,
                    success: function(result) {
                        $('#tableContainer').html(result);
                        addBootstrapTooltips("#tableContainer");
                    }
                });
                return false;
            });
        $(document).on("change",
            "#pageSizeSelector",
            function() {
                var selectedValue = $(this).val();
                $.ajax({
                    url: selectedValue,
                    type: 'GET',
                    cache: false,
                    success: function(result) {
                        $('#tableContainer').html(result);
                        addBootstrapTooltips("#tableContainer");
                    }
                });
            });

        @* Sorting Async Partial Handling *@
        $(document).on("click",
            "#tableHeader a",
            function() {
                $.ajax({
                    url: $(this).attr("href"),
                    type: 'GET',
                    cache: false,
                    success: function(result) {
                        $('#tableContainer').html(result);
                        addBootstrapTooltips("#tableContainer");
                    }
                });

                return false;
            });
    });
    </script>
}

@section additionalStyles {
    @Styles.Render("~/plugins/datatables/media/css/cssDatatables")
}

<article class="row">
    @*<h1 class="pageTitle artistHeader fw200 mb20 mt10">@ViewBag.Title</h1>*@

    <div class="col-md-12">
        <div class="panel panel-visible" id="tableContainer">
            @Html.Partial("_SocietiesList", Model)
        </div>
    </div>
</article>
@{
ViewBag.Title=“社团和代理”;
}
@节脚本{
@*准备好了吗*@
$(函数(){
addTableStylingScripts();
@*分页异步部分处理*@
$(文档)。在(“单击”,
“#indexPager a”,
函数(){
if($(this.parent().hasClass('disabled')| |$(this.parent().hasClass('active'))
返回false;
$.ajax({
url:$(this.attr(“href”),
键入:“GET”,
cache:false,
成功:功能(结果){
$('#tableContainer').html(结果);
addBootstrapTooltips(“tableContainer”);
}
});
返回false;
});
$(文档)。在(“更改”,
“#页面大小选择器”,
函数(){
var selectedValue=$(this.val();
$.ajax({
url:selectedValue,
键入:“GET”,
cache:false,
成功:功能(结果){
$('#tableContainer').html(结果);
addBootstrapTooltips(“tableContainer”);
}
});
});
@*排序异步部分处理*@
$(文档)。在(“单击”,
“#表格标题a”,
函数(){
$.ajax({
url:$(this.attr(“href”),
键入:“GET”,
cache:false,
成功:功能(结果){
$('#tableContainer').html(结果);
addBootstrapTooltips(“tableContainer”);
}
});
返回false;
});
});
}
@节附加样式{
@style.Render(“~/plugins/datatables/media/css/cssDatatables”)
}
行动
@foreach(模型社会中的var t)
{
@t、 社会名称
@t、 西萨科德
@t、 装运目标
@如果(t.代理组织)
{
}
其他的
{
}
行动
tableRowIndex++; } @Html.Partial(“_分页”,Model.pagininfo)
我有点不确定是什么导致了这个问题,因为它不在源代码中,只有当你检查显示的元素时,我才检查了代码并确保所有的开始和结束标记匹配,但是我有相同的AJAX和用于类似页面的部分。所以我发现很奇怪,它仅仅发生在这个页面上蓝色。

必须添加

// AJAX?
        if (!Request.IsAjaxRequest())
        {
            return View(model);
        }
        return PartialView("_SocietiesList", model);
    }
在我的Post请求中,它像以前一样返回整个页面,而不是部分页面

// AJAX?
        if (!Request.IsAjaxRequest())
        {
            return View(model);
        }
        return PartialView("_SocietiesList", model);
    }