Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在布局视图中显示模型项而不干扰其他模型视图?_C#_Asp.net Core_Model View Controller - Fatal编程技术网

C# 如何在布局视图中显示模型项而不干扰其他模型视图?

C# 如何在布局视图中显示模型项而不干扰其他模型视图?,c#,asp.net-core,model-view-controller,C#,Asp.net Core,Model View Controller,为了澄清这一点,我试图在我的登录部分视图中以通知样式的方式显示传入请求。当我当前正在寻找的页面是该特定模型的索引时,这一切都很好 @model IEnumerable<ResultatenSysteem.Models.OpleidingAanvraag> @model IEnumerable 否则会抛出一个错误: InvalidOperationException:传递到 ViewDataDictionary的类型为 'System.Collections.Generic.Lis

为了澄清这一点,我试图在我的
登录部分
视图中以通知样式的方式显示传入请求。当我当前正在寻找的页面是该特定模型的索引时,这一切都很好

@model IEnumerable<ResultatenSysteem.Models.OpleidingAanvraag>
@model IEnumerable
否则会抛出一个错误:

InvalidOperationException:传递到 ViewDataDictionary的类型为 'System.Collections.Generic.List1[ResultatenSysteem.Models.ResultAt], 但此ViewDataDictionary实例需要类型为的模型项 'System.Collections.Generic.IEnumerable'1[ResultatenSysteem.Models.OpleidingAanvraag]'

如何在每页显示的局部视图中显示型号
OpleidingAanvraag
的项目

要明确的是: 每次尝试访问非OpleidingAanvraag索引的页面时,都会引发此错误。这是因为索引的类型为:
@model IEnumerable


每隔一页就会出现一个与上述内容类似的错误,我认为这是因为它正在尝试加载两个模型。

能否将您的
操作方法添加到问题中。您可以创建一个特定的局部视图,并将其放置在布局上。与
结果系统视图.models.resultAt
相比,什么是
结果系统视图.models.opleidingaavraag
?他们有关系吗?不,我想澄清一下。这个错误是我试图打开的特定页面所特有的,我认为这是因为该页面试图加载两个模型。OpleidingAanvraag有我想在局部视图中显示的项目(将显示在网站的每个页面上)@SatishSingh我该怎么做?由于页面正在尝试加载多个模型,我不会仍然收到错误吗?