Asp.net mvc ASP.NET MVC仅呈现自定义控件

Asp.net mvc ASP.NET MVC仅呈现自定义控件,asp.net-mvc,view,kendo-ui,telerik,kendo-asp.net-mvc,Asp.net Mvc,View,Kendo Ui,Telerik,Kendo Asp.net Mvc,我已经为这个问题争论了一个多星期了,20个开发者都不知道到底发生了什么。我希望这里的人以前见过这个问题 免责声明:该网站是一个政府网站,它的密码保护在一个安全的网络,所以很遗憾,我不能提供一个链接。但我会尽可能多地解释。如果您需要任何特定代码,我可以提供。我只是不想用很多无用的代码把这个问题弄得一团糟。就这样 环境:ASP.NET MVC 控制:剑道电传 架构:布局>视图>局部视图 有问题的屏幕是搜索结果屏幕。当应用程序运行时,它将继承一个_SharedLayout。在该布局(母版页)内是视

我已经为这个问题争论了一个多星期了,20个开发者都不知道到底发生了什么。我希望这里的人以前见过这个问题

免责声明:该网站是一个政府网站,它的密码保护在一个安全的网络,所以很遗憾,我不能提供一个链接。但我会尽可能多地解释。如果您需要任何特定代码,我可以提供。我只是不想用很多无用的代码把这个问题弄得一团糟。就这样

  • 环境:ASP.NET MVC
  • 控制:剑道电传
  • 架构:布局>视图>局部视图
有问题的屏幕是搜索结果屏幕。当应用程序运行时,它将继承一个_SharedLayout。在该布局(母版页)内是视图所在的位置。在本例中,将显示Search.vbhtml视图。到目前为止,页面没有问题。当我在搜索框中输入信息并运行搜索按钮时,就会出现问题。该视图连接到数据库,并返回数据,但_SharedLayout和Search视图不呈现。检查完浏览器后,我注意到以下几点

<html>
  <head> NOTHING HERE</head>
  <body>
      WHERE IS THE REST OF THE PAGE? LAYOUT AND SEARCH VIEW
      <div>
         Search result control forms and tables and all the good stuff 
      </div>
      FOOTER IS MISSING TOO
  </body>
</html>

这里什么都没有
这一页的其余部分在哪里?布局和搜索视图
搜索结果控制表单和表格以及所有的好东西
页脚也不见了
当然,在页面头部没有任何引用的情况下,SearchResults视图输出的是无样式的(尽可能普通)

以下是搜索视图的代码(生成结果的按钮所在的位置)。正如我上面所说,如果您需要控制器代码或其他任何东西,我将尽我所能提供它

@Modeltype IndividualSearchViewModel

@Code
   Layout = Nothing
   ViewData("Title") = "Search Individual"
   ViewData("PageName") = "Search Individual"
   Dim isPopupMode As String = "N"
   Dim ajaxAction = New AjaxOptions With {.HttpMethod = "post", .UpdateTargetId = "IndividualSearchContent", .InsertionMode = InsertionMode.Replace}

   If Not Model.Mode Is Nothing AndAlso Model.Mode.Equals("popup", StringComparison.CurrentCultureIgnoreCase) Then
      isPopupMode = "Y"
      ajaxAction.OnBegin = "OnPopupRequestBegin('IndividualSearchContent')"
      ajaxAction.OnComplete = "OnPopupRequestComplete('IndividualSearchContent')"
   Else
      ajaxAction.OnBegin = "OnPageRequestBegin"
      ajaxAction.OnComplete = "OnPageRequestComplete"
   End If

   End Code

   <div id="IndividualSearchContent">
       @Using Ajax.BeginForm("Index", "IndividualSearch", ajaxAction, New With {.role = "form"})
       @<div class="searchCriteriaDivCss @(If(isPopupMode = "Y", "hidden", ""))">
       @Html.ValidationSummary(False, "", New With {.class = "text-danger"})
    </div>

    @<div class="form-horizontal">
         @If Model.Messages IsNot Nothing Then
             @<div id="ValidationMessages" class="form-group text-center">
                 @For Each message In Model.Messages
                     @<b>@message</b>
                     @<br />
                 Next
             </div>
             @<br />
         End If


    <div class="row">
      <div class="col-xs-12">

        <div class="form-group">
            @Html.LabelFor(Function(m) m.IdentifierType, New With {.class = "col-md-3 col-sm-12 col-xs-12"})
            <div class="col-md-3 col-sm-12 col-xs-12">
                @Html.Kendo.DropDownListFor(Function(m) m.IdentifierTypeValue).HtmlAttributes(New With {.class = "form-control"}).BindTo(Model.IdentifierType).OptionLabel("Select One")
            </div>

            @Html.LabelFor(Function(m) m.Identifier, New With {.class = "col-md-3 col-sm-12 col-xs-12"})
            <div class="col-md-3 col-sm-12 col-xs-12">
                @Html.Kendo.MaskedTextBoxFor(Function(m) m.Identifier).Mask("#########").HtmlAttributes(New With {.class = "form-control"})
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(Function(m) m.LastName, New With {.class = "col-md-3 col-sm-12 col-xs-12"})
            <div class="col-md-3 col-sm-12 col-xs-12">
                @Html.TextBoxFor(Function(m) m.LastName, htmlAttributes:=New With {Key .maxlength = "50", .class = "form-control"})
            </div>

            @Html.LabelFor(Function(m) m.FirstName, New With {.class = "col-md-3 col-sm-12 col-xs-12"})
            <div class="col-md-3 col-sm-12 col-xs-12">
                @Html.TextBoxFor(Function(m) m.FirstName, htmlAttributes:=New With {Key .maxlength = "50", .class = "form-control"})
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(Function(m) m.IndividualDOB, New With {.class = "col-md-3 col-sm-12 col-xs-12"})
            <div class="col-md-3 col-sm-12 col-xs-12">
                @Html.Kendo.DatePickerFor(Function(m) m.IndividualDOB).Max(Date.Today).HtmlAttributes(New With {.class = "form-control", .maxlength = "10"})
            </div>

            @Html.Label("Residential County:", New With {.class = "col-md-3 col-sm-12 col-xs-12"})
            <div class="col-md-3 col-sm-12 col-xs-12">
                @Html.Kendo.DropDownListFor(Function(m) m.ResidentialCounty).BindTo(Model.ResidentialCountyOptions).OptionLabel("Select One").HtmlAttributes(New With {.class = "form-control"})
            </div>
          </div>
        </div>
      </div>
      <div class="row">
        <div class="col-xs-12 text-center submitButtons">
            @Html.Kendo.Button().Name("Clear").Content("Clear <i class='fa fa-times'></i>").HtmlAttributes(New With {.type = "submit", .name = "SubmitAction", .id = "clear", .value = "clear", .class = "btn-primary"})
            @Html.Kendo.Button().Name("Search").Content("Search <i class='fa fa-search'></i>").HtmlAttributes(New With {.type = "submit", .name = "SubmitAction", .id = "search", .value = "search", .class = "btn-green"})
        </div>
      </div>
      <div class="row">
        <div class="col-xs-12">
            <div class="form-group text-center">
                 &nbsp;
            </div>
        </div>
      </div>

      @If Model.SearchResults Is Nothing Then
        @<div class="row">
          <div class="col-xs-12">
            <div class="form-group text-center complaintDetailButtons">
                @Html.Kendo.Button().Name("NoIndividual").Content("<span>Continue Without Selecting<br> an Individual</span> <i class='fa fa-arrow-right'></i>").HtmlAttributes(New With {.id = "btnNoIndividual", .class = "btn btn-primary btn-xl long-wrap", .value = "noindividual"})
            </div>
          </div>
       </div>

       End If

       @If (Model.SearchResults Is Nothing OrElse Model.SearchResults.Count = 0) AndAlso (Model.ProgramOffices IsNot Nothing AndAlso Model.ProgramOffices.Contains(EIM.BO.Enumerators.ProgramOffice.ODP)) AndAlso (Model.IsLicensed) Then
          @<div class="row">
              <div class="col-xs-12">   
          @Html.Kendo.Button().Name("NoMCI").ImageUrl(Url.Content("~/Content/Images/buttons/noMCI.jpg")).HtmlAttributes(New With {.id = "btnNoMCI", .value = "nomci"})
              </div>
          </div>
       End If

       @If Not Model.SearchResults Is Nothing AndAlso Model.SearchResults.Count > 0 Then
        @<div class="row" id="resultsGrid">
            <div class="col-xs-12">
                 @(Html.Kendo.Grid(Of IndividualSearchResultViewModel)(Model.SearchResults).
                                Name("SearchIndivResults").
                                Sortable(Function(s) s.AllowUnsort(False)).
                                Filterable().
                                Scrollable(Sub(s) s.Height("100%")).
                                Columns(Sub(c)
                                            c.Bound(Function(m) m.MCI).ClientTemplate("<a href='' class='MCILink' id='#:MCI#_#:IndividualResultId#_#:ProgramOffice#'>#=MCI#</a>")
                                            c.Bound(Function(m) m.SSN)
                                            c.Bound(Function(m) m.Name).HtmlAttributes(New With {.class = "MCIName"})
                                            c.Bound(Function(m) m.DOB)
                                            c.Bound(Function(m) m.ResidentialCounty)
                                            c.Bound(Function(m) m.ProgramOffice)
                                            c.Bound(Function(m) m.WaiverName)
                                            c.Bound(Function(m) m.ProgramEffectiveDates)
                                            c.Bound(Function(m) m.SourceSystem).Hidden()
                                            c.Bound(Function(m) m.Line1).Hidden()
                                            c.Bound(Function(m) m.Line2).Hidden()
                                            c.Bound(Function(m) m.Line3).Hidden()
                                            c.Bound(Function(m) m.MI).Hidden()
                                            c.Bound(Function(m) m.Suffix).Hidden()
                                            c.Bound(Function(m) m.Gender).Hidden()
                                            c.Bound(Function(m) m.Phone).Hidden()
                                            c.Bound(Function(m) m.Email).Hidden()
                                            c.Bound(Function(m) m.City).Hidden()
                                            c.Bound(Function(m) m.State).Hidden()
                                            c.Bound(Function(m) m.Zip).Hidden()
                                            c.Bound(Function(m) m.FirstName).Hidden()
                                            c.Bound(Function(m) m.LastName).Hidden()
                                            c.Bound(Function(m) m.SourceSystemKey).Hidden()
                                            c.Bound(Function(m) m.IndividualResultId).Hidden()
                                            c.Bound(Function(m) m.SCEntityName).Hidden()
                                            c.Bound(Function(m) m.SCFirstName).Hidden()
                                            c.Bound(Function(m) m.SCLastName).Hidden()
                                            c.Bound(Function(m) m.SCPhone).Hidden()
                                            c.Bound(Function(m) m.HiddenDOB).Hidden()
                                            c.Bound(Function(m) m.FundingCounty).Hidden()
                                            c.Bound(Function(m) m.Region).Hidden()
                                            c.Bound(Function(m) m.BSU).Hidden()
                                            c.Bound(Function(m) m.AssignedSCUserID).Hidden()
                                            c.Bound(Function(m) m.AssignedSCSupervisorUserID).Hidden()

                                        End Sub).
                                DataSource(Sub(s) s.Ajax().ServerOperation(False)))
             </div>
          </div>
        End If

        @Html.HiddenFor(Function(m) m.Mode)
        @Html.Hidden("SelectedMciNum")
        @Html.Hidden("SelectedSSN")
        @Html.Hidden("SelectedName")
        @Html.Hidden("SelectedDOB")
        @Html.Hidden("SelectedFirstName")
        @Html.Hidden("SelectedLastName")
        @Html.HiddenFor(Function(m) m.FilingOrganizationFilter)

        <input type="hidden" id="CallingPage" name="CallingPage" value="@Model.CallingPage" />
     </div>

     End Using
   </div>


   <script type="text/javascript">

      $(document).ready(function () {

        $(this).keypress(function (e) {
          if (e.keyCode == 13) {
            $('#search').click();
            e.preventDefault();
          }
        })

      $("#Search").focus();

      $("#Identifier:text").on("focus", function () {
         var input = $(this);
         setTimeout(function () { input.select(); });
      });

      var errortext = "@Model.errorText"

      if(errortext != "")
        {
          var errorarray = errortext.split('~');
          var errormsg = "";
          for (var i = 0; i <errorarray.length; i++)
          {
            errormsg += errorarray[i] + '<br/>';
          }
          errortext = errormsg.substring(0, errormsg.length - 5);
        }
        $("#kendoValidatorField").html(errortext);

        var pageComingFrom = sessionStorage.getItem("pageComingFrom");
        var isPopUp = '@isPopupMode';

        if (pageComingFrom == "null" || isPopUp == 'Y') {
          var btnNoIndiv = $("#btnNoIndividual");
          btnNoIndiv.hide();
        }

        var filingOrganization = sessionStorage.getItem("filingOrganization");

        //clear sessionStorage
        sessionStorage.removeItem("filingOrganization");
        if (!filingOrganization) {
          filingOrganization = $("#FilingOrganization").val();
        }

    if (filingOrganization) {
          $("#FilingOrganizationFilter").val(filingOrganization);
    }


    $("div#IndividualSearchContent").on("click", "a.MCILink", function (e) {
        sessionStorage.setItem("IsContinueWithOutSelectingClicked", "No")
        if ($('#IndividualMCI') && $('#IndividualMCI').length > 0) {
            $('#IndividualMCI').val($(this).text());
            $('#IndividualMCIDiv').html($('#IndividualMCI')[0].value)
            $('#IndividualName').val($(this)[0].parentNode.nextSibling.nextSibling.innerText);
            $('#IndividualNameDiv').html($('#IndividualName')[0].value);
        }

        var dataToSend;
        var gridData = $("#SearchIndivResults").data("kendoGrid");
        if (gridData != null) {
            var selectedItem = this.id;

            var value = gridData._data.length;
            for (var i = 0; i < value; i++) {
                var item = gridData._data[i];
                var selectedItemRecord = item.MCI +'_'+ item.IndividualResultId+'_'+item.ProgramOffice
                if (selectedItemRecord == selectedItem) {
                    dataToSend = item;
                                           sessionStorage.setItem("selectedItemDOB", dataToSend.HiddenDOB.split(" ")[0])
                                           sessionStorage.setItem("selectedItemMCI", dataToSend.MCI)
                                           sessionStorage.setItem("selectedItemName", dataToSend.Name)
                                           sessionStorage.setItem("selectedItemProgEffDt", dataToSend.ProgramEffectiveDates)
                                           sessionStorage.setItem("selectedItemPO", dataToSend.ProgramOffice)
                                           sessionStorage.setItem("selectedItemSS", dataToSend.SourceSystem)
                                           sessionStorage.setItem("selectedItemSSKey", dataToSend.SourceSystemKey)
                                           sessionStorage.setItem("selectedItemSSN", dataToSend.SSN)
                                           sessionStorage.setItem("selectedItemWaiver", dataToSend.Waiver)

                                           sessionStorage.setItem("selectedItemLine1", dataToSend.Line1)
                                           sessionStorage.setItem("selectedItemLine2", dataToSend.Line2)
                                           sessionStorage.setItem("selectedItemLine3", dataToSend.Line3)
                                           sessionStorage.setItem("selectedItemMI", dataToSend.MI)
                                           sessionStorage.setItem("selectedItemSuffix", dataToSend.Suffix)
                                           sessionStorage.setItem("selectedItemGender", dataToSend.Gender)
                                           sessionStorage.setItem("selectedItemPhone", dataToSend.Phone)
                                           sessionStorage.setItem("selectedItemEmail", dataToSend.Email)
                                           sessionStorage.setItem("selectedItemCity", dataToSend.City)                                               
                                           sessionStorage.setItem("selectedItemCounty", dataToSend.ResidentialCounty)
                                           sessionStorage.setItem("selectedItemFundingCounty", dataToSend.FundingCounty)
                                           sessionStorage.setItem("selectedItemRegion", dataToSend.Region)
                                           sessionStorage.setItem("selectedItemState", dataToSend.State)
                                           sessionStorage.setItem("selectedItemZip", dataToSend.Zip)
                                           sessionStorage.setItem("selectedItemIndividualResultId", dataToSend.IndividualResultId)                                             
                                           sessionStorage.setItem("selectedItemSCEntityName", dataToSend.SCEntityName)
                                           sessionStorage.setItem("selectedItemSCFirstName", dataToSend.SCFirstName)
                                           sessionStorage.setItem("selectedItemSCLastName", dataToSend.SCLastName)
                                           sessionStorage.setItem("selectedItemSCPhone", dataToSend.SCPhone)
                                           sessionStorage.setItem("selectedItemHiddenDOB", dataToSend.HiddenDOB)
                                           sessionStorage.setItem("selectedBSU", dataToSend.BSU)
                                           sessionStorage.setItem("selectedAssignedSCUserID", dataToSend.AssignedSCUserID)
                                           sessionStorage.setItem("selectedAssignedSCSupervisorUserID", dataToSend.AssignedSCSupervisorUserID)

                }
            }
        }


        $("#SelectedMciNum").val($(this).text());
        if ($("#IndividualSearchWindow").data("kendoWindow")) {
          $("#IndividualSearchWindow").data("kendoWindow").close();
        }


        e.preventDefault();
      })

      $('#btnNoIndividual').click(function (e) {
         sessionStorage.setItem("IsContinueWithOutSelectingClicked", "Yes")
         window.location.href = baseUrl + "ComplaintIndividualInformation/Index";
      })

      $('#btnNoMCI').click(function (e) {
          window.location.href = baseUrl + "IndividualDetail/IndividualHasNoMCI";
      })

      ValidateTextDate();
   });

   </script>
@Modeltype IndividualSearchViewModel
@代码
布局=无
ViewData(“标题”)=“搜索个人”
ViewData(“PageName”)=“搜索个人”
Dim isPopupMode As String=“N”
Dim ajaxAction=带有{.HttpMethod=“post”、.UpdateTargetId=“IndividualSearchContent”、.InsertionMode=InsertionMode.Replace}的新AjaxOptions
如果不是Model.Mode是Nothing,那么也是Model.Mode.Equals(“弹出”,StringComparison.CurrentCultureIgnoreCase),然后
ispoupmode=“Y”
ajaxAction.OnBegin=“OnPopupRequestBegin('IndividualSearchContent')”
ajaxAction.OnComplete=“OnPopupRequestComplete('IndividualSearchContent')”
其他的
ajaxAction.OnBegin=“OnPageRequestBegin”
ajaxAction.OnComplete=“OnPageRequestComplete”
如果结束
结束代码
@使用Ajax.BeginForm(“Index”,“IndividualSearch”,ajaxAction,新增为{.role=“form”})
@
@Html.ValidationSummary(False,“,新加{.class=“text danger”})
@
@如果Model.Messages不是空的,那么
@
@对于Model.Messages中的每条消息
@@信息
@
下一个 @
如果结束 @LabelFor(Function(m)m.IdentifierType,新增为{.class=“col-md-3 col-sm-12 col-xs-12”}) @Html.Kendo.DropDownListFor(函数(m)m.IdentifierTypeValue).HtmlAttributes(新的带有{.class=“form control”}).BindTo(Model.IdentifierType).OptionLabel(“选择一个”) @LabelFor(函数(m)m.Identifier,新增为{.class=“col-md-3 col-sm-12 col-xs-12”}) @Html.Kendo.MaskedTextBoxFor(Function(m)m.Identifier).Mask(“{.class=”form control“)的新名称) @LabelFor(函数(m)m.LastName,新增为{.class=“col-md-3 col-sm-12 col-xs-12”}) @text.TextBoxFor(函数(m)m.LastName,htmlAttributes:=带有{Key.maxlength=“50”,.class=“form control”}的新函数) @Html.LabelFor(函数(m)m.FirstName,新增为{.class=“col-md-3 col-sm-12 col-xs-12”}) @text.TextBoxFor(函数(m)m.FirstName,htmlAttributes:=New,带有{Key.maxlength=“50”,.class=“form control”}) @LabelFor(Function(m)m.IndividualDOB,新增为{.class=“col-md-3 col-sm-12 col-xs-12”}) @Html.Kendo.DatePickerFor(Function(m)m.IndividualDOB).Max(Date.Today).HtmlAttributes(新增了{.class=“form control”,.maxlength=“10”}) @Html.Label(“居住县:”,新增为{.class=“col-md-3 col-sm-12 col-xs-12”}) @Html.Kendo.DropDownListFor(Function(m)m.ResidentialCounty).BindTo(Model.ResidentialCountyOptions).OptionLabel(“Select One”).HtmlAttributes(使用{.class=“form control”}新建) @Html.Kendo.Button().Name(“Clear”).Content(“Clear”).HtmlAttributes(新增为{.type=“submit”、.Name=“SubmitAction”、.id=“Clear”、.value=“Clear”、.class=“btn primary”}) @Html.Kendo.Button() @如果Model.SearchResults为空,则 @ @Html.Kendo.Button() 如果结束 @如果(Model.SearchResults为Nothing或lse Model.SearchResults.Count=0)和(Model.ProgramOffice不是Nothing,并且Model.ProgramOffice.Contains(EIM.BO.Enumerators.ProgramOffice.ODP))和(Model.IsLicensed),则 @ @Html.Kendo.Button().Name(“NoMCI”).ImageUrl(Url.Content(“~/Content/Images/buttons/NoMCI.jpg”)).HtmlAt