问题描述
我有一个应用程序,其中包含产品结构的引导标签。一个选项卡显示产品信息,其他显示图库和变体,最后一个选项卡是一个表单。
我能够使用MVC创建第一个选项卡的结构但是当我开始时在第二个标签上工作,我卡住了。我有第一个选项卡的视图和模型,在第二个选项卡中,我渲染了另一个与另一个模型相关联的视图。两个模型都来自不同的文件夹结构。
我收到的错误是
Hi,
I have an application which contains bootstrap tab like structure for a product. One tab shows product information other shows gallery and variants and the last tab is a form.
I am able to create a structure for first tab using MVC but when I started working on second tab, I got stuck. I had a view and model for first tab and in second tab I rendered another view attached with another model. Both models are from different folder structure.
I am getting error that
The model item passed into the dictionary is of type 'one', but this dictionary requires a model item of type 'two'.]
我想我还没有正确创建模型和视图结构。
我尝试了什么:
我正在尝试将标签链接到控制器,它将呈现视图和进一步但在引导选项卡结构中所有三个选项卡内容属于同一HTML DOM。所以,我很难将控制器链接放到标签上。
I think I haven't created model and view structure correctly.
What I have tried:
What I am trying is to make tabs link to controller which will render the view and further but in bootstrap tab structure all three tab content belong to same HTML DOM. So, I am having difficulty in putting controller link to tabs.
推荐答案
@Html.RenderAction
到标签页。这将向控制器动作发送请求以呈现部分视图。
into tabs. this will send request to controller action to render a partial view.
这篇关于如何设计制表结构的模型和视图组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!