Asp.net mvc 如何在MVC的部分视图中填充导航选项卡上的数据?

Asp.net mvc 如何在MVC的部分视图中填充导航选项卡上的数据?,asp.net-mvc,Asp.net Mvc,我有两个导航标签的局部视图。在每个选项卡上,我想根据国家填充数据 目前,我遇到以下错误: 堆栈不足,无法继续安全执行程序。这个可以 由于调用堆栈上的函数太多或 堆栈使用了太多的堆栈空间 控制器 public ActionResult Index() { ClsHome model = new ClsHome(); return View(model); } public PartialViewRes

我有两个导航标签的局部视图。在每个选项卡上,我想根据国家填充数据

目前,我遇到以下错误:

堆栈不足,无法继续安全执行程序。这个可以 由于调用堆栈上的函数太多或 堆栈使用了太多的堆栈空间

控制器

public ActionResult Index()
        {
            ClsHome model = new ClsHome();

            return View(model);
        }

       public PartialViewResult EmployeeBasedCountry(int CountryId)
        {
           ClsHome clshome=new ClsHome();
            clshome.Country = CountryId;

            clshome.countries = CountryFilter(CountryId);          
           return PartialView("~/Views/Home/_pEmp.cshtml", clshome);
        }
索引视图

@model EmpWebsite.Models.Home.ClsHome      

<div class="col-md-5">                 
   @Html.Partial("_pEmp")
</div>
@model EmpWebsite.Models.Home.ClsHome
@Html.部分(“_pEmp”)
局部视图

@model EmpWebsite.Models.Home.ClsHome  
      <ul class="nav nav-tabs nav-justified">
            <li class="active"><a data-toggle="tab" href="#Tab1">India</a></li>
            <li><a data-toggle="tab" href="#Tab2" style="width:auto">USA</a></li>            
        </ul>


       <div class="tab-content">
             <div id="Tab1" class="tab-pane fade">
              @Html.Action("EmployeeBasedCountry", new { @CountryId = "1" })
                <div class="panel">
                    <table class="table-striped">
                        <tr class="heading">
                            <th>
                                EmpId
                            </th>
                            <th>
                                EmpName
                            </th>

                        </tr>

                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    @item.EmpId
                                </td>
                                <td>
                                    <a>@item.EmpName</a>
                                </td>


                            </tr>
                        }

                    </table>
                </div>
            </div>
            <div id="Tab2" class="tab-pane fade">
              @Html.Action("EmployeeBasedCountry", new { @CountryId = "2" })
                <div class="panel">
                    <table class="table-striped">
                        <tr class="heading">
                            <th>
                                EmpId
                            </th>
                            <th>
                                EmpName
                            </th>

                        </tr>

                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    @item.EmpId
                                </td>
                                <td>
                                    <a>@item.EmpName</a>
                                </td>


                            </tr>
                        }

                    </table>
                </div>
            </div>         


        </div>
@model EmpWebsite.Models.Home.ClsHome
@Action(“EmployeeBasedCountry”,new{@CountryId=“1”}) 埃皮德 EmpName @foreach(模型中的var项目) { @item.EmpId @item.EmpName } @Action(“EmployeeBasedCountry”,new{@CountryId=“2”}) 埃皮德 EmpName @foreach(模型中的var项目) { @item.EmpId @item.EmpName }
你的
\u pEmp.cshtml
中的
@Html.Action()
部分调用
EmployeeBasedCountry()
返回
\u pEmp.cshtml
调用
@Html.Action()
返回
\u pEmp.cshtml
调用
@Html.Action()的
返回
\u pEmp.cshtml
等等on@StephenMuecke正是你所说的。如何解决此问题?可能您打算编写
@Html.ActionLink
而不是
@Html.Action
,以获取锚定标记。只需删除您数据库中的
@Html.Action()
partial@StephenMuecke,那么我怎样才能通过CountryId?请帮帮我。