strongly-typed-view

ASP.NET MVC, strongly typed views, partial view parameters glitch

前提是你 提交于 2019-11-26 23:07:47
问题 If i got view which inherits from: System.Web.Mvc.ViewPage<Foo> Where Foo has a property Bar with a type string And view wants to render strongly typed partial view which inherits from: System.Web.Mvc.ViewUserControl<string> like this: Html.RenderPartial("_Bar", Model.Bar);%> Then why it will throw this: The model item passed into the dictionary is of type 'Foo' but this dictionary requires a model item of type 'System.String'. when bar is not initialized? More specific: why it passes Foo,