Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 10, 2012 01:00 PM by andri745
Member
163 Points
73 Posts
May 03, 2012 09:02 AM|LINK
Hi to all. I'd like to use a typed partial view with a specific model into a typed view with a different model. How can I do it?
Participant
1358 Points
250 Posts
May 03, 2012 09:10 AM|LINK
Hi,
I am considering typed view means strongly type view. You can go thru below link...
http://stackoverflow.com/questions/5441615/how-i-can-render-partial-views-in-asp-net-mvc-3
May 03, 2012 09:59 AM|LINK
My partial view has this first line:
@model IEnumerable<MyEntitiesLibrary.MyEntity>
I call this with:
@Html.Partial("_ViewCC")
I cannot use
@Html.Partial("_ViewCC", MyEntity)
or
@Html.Partial("_ViewCC", Model)
because Model is another model type of main view.
All-Star
21111 Points
1817 Posts
Microsoft
May 10, 2012 06:42 AM|LINK
Hi
Why not put these model into a viewmodel. I think it is the easiest way. Look here:
http://stephenwalther.com/blog/archive/2009/04/13/asp-net-mvc-tip-50-ndash-create-view-models.aspx
Hope this helpful Regards Young Yang
May 10, 2012 01:00 PM|LINK
Thanks for your reply. You solved my problem.
andri745
Member
163 Points
73 Posts
MVC 3 partial view with different model
May 03, 2012 09:02 AM|LINK
Hi to all. I'd like to use a typed partial view with a specific model into a typed view with a different model. How can I do it?
--
Blog
Microsoft MCPD - Web Developer .NET 4
r.rajeshkhun...
Participant
1358 Points
250 Posts
Re: MVC 3 partial view with different model
May 03, 2012 09:10 AM|LINK
Hi,
I am considering typed view means strongly type view. You can go thru below link...
http://stackoverflow.com/questions/5441615/how-i-can-render-partial-views-in-asp-net-mvc-3
======================================
Microsoft® Community Contributor 2011 | AWARD
MCTS
My Blog
Follow Me
andri745
Member
163 Points
73 Posts
Re: MVC 3 partial view with different model
May 03, 2012 09:59 AM|LINK
My partial view has this first line:
I call this with:
@Html.Partial("_ViewCC")I cannot use
@Html.Partial("_ViewCC", MyEntity)or
@Html.Partial("_ViewCC", Model)because Model is another model type of main view.
--
Blog
Microsoft MCPD - Web Developer .NET 4
Young Yang -...
All-Star
21111 Points
1817 Posts
Microsoft
Re: MVC 3 partial view with different model
May 10, 2012 06:42 AM|LINK
Hi
Why not put these model into a viewmodel. I think it is the easiest way. Look here:
http://stephenwalther.com/blog/archive/2009/04/13/asp-net-mvc-tip-50-ndash-create-view-models.aspx
Hope this helpful
Regards
Young Yang
Feedback to us
Develop and promote your apps in Windows Store
andri745
Member
163 Points
73 Posts
Re: MVC 3 partial view with different model
May 10, 2012 01:00 PM|LINK
Thanks for your reply. You solved my problem.
--
Blog
Microsoft MCPD - Web Developer .NET 4