MVC Page Template Configuration in the View file itself?

Go To StackoverFlow.com

0

I want to render an MVC Page/View that will have varying widgets on the page. So some views might have Widget A, another page could have Widget A and B, etc. I was thinking each widget would be a partial view that I want to pass parameters. So if it was a weather widget, I would need to pass the partial view the Zip code etc.

My question is what the best way to approach this architecturally? We currently have an external xml file that stores this info: myview.xml (for myview.cshtm)
We don’t want to have an external file, but would like to store everything in one place maybe in the header of the view file itself? Any recommendations?

2012-04-04 18:07
by Bill Porter
Can you clarify what exactly you are storing in that xml file? A mapping between property and partial views? Is there a reason to abstract it in that way instead of just specifying the partial and the property directly in the Html.Partial call - bhamlin 2012-04-04 19:49


1

Independent widgets on your views?

Sounds like you just need to use RenderAction to render them.

More info by Haack

MSDN

2012-04-04 20:45
by Bertvan
You got it!! That's what was decided on. Thanks - Bill Porter 2012-04-07 14:56
Ads