C# 向视图组件和视图传递数据时重叠

C# 向视图组件和视图传递数据时重叠,c#,asp.net-core-mvc,C#,Asp.net Core Mvc,在ASP.NET MVC核心项目中 我在布局页面中有View组件,并将字符串类型数据传递给它 我有一个视图,我将integer类型的数据传递给它 运行该错误时出现问题: InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'System.Int', but this ViewDataDictionary instance requires a model item of t

在ASP.NET MVC核心项目中

我在布局页面中有View组件,并将字符串类型数据传递给它

我有一个视图,我将integer类型的数据传递给它

运行该错误时出现问题:

InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'System.Int', but this ViewDataDictionary instance requires a model item of type 'System.String'.

问题在于我将模型作为字符串传递给视图组件, 视图将其作为视图名称而不是模型 我把我的字符串放在课堂上,作为模型类传递,它和我一起工作
感谢任何人尝试帮助我

返回视图(yourInteger.ToString())
您能提供源代码供我们查看吗?