Then I created my own subclass of Controller and overrode the RenderView method to create this container and pass it along to the view.
Does your RenderView override also know how to retrieve the data? That would feel alittle off.
Looking at the requirement, it seems pretty obvious that retrieving a list of recent blog posts is a seperate action from whatever action you are performing. (Especially true if you work with RESTful applications). One quick solution is to turn that into
a seperate AJAX call. Drawback is the complexity of managing the AJAX behavior and the extra workload on the server. Might not be suitable for everyone. Another way I can see this being addressed down the road in the next CTP drop is through some type of post
action filter that allows you to specify additional "complimentary" actions to your main action. (I don't know what would be the right term to use here). That way we don't violate SoC, SRP and all that goodness.
Now thinking about this, does RenderView actually spit out the html to the response stream when you call it or does it mark the view you are interested and delay the rendering to a later stage? That will effect what you can do in a post action filter.
shinakuma
Member
378 Points
92 Posts
Re: Passing data to Master pages in ASP.NET MVC
Dec 14, 2007 05:08 PM|LINK
Does your RenderView override also know how to retrieve the data? That would feel alittle off.
Looking at the requirement, it seems pretty obvious that retrieving a list of recent blog posts is a seperate action from whatever action you are performing. (Especially true if you work with RESTful applications). One quick solution is to turn that into a seperate AJAX call. Drawback is the complexity of managing the AJAX behavior and the extra workload on the server. Might not be suitable for everyone. Another way I can see this being addressed down the road in the next CTP drop is through some type of post action filter that allows you to specify additional "complimentary" actions to your main action. (I don't know what would be the right term to use here). That way we don't violate SoC, SRP and all that goodness.
Now thinking about this, does RenderView actually spit out the html to the response stream when you call it or does it mark the view you are interested and delay the rendering to a later stage? That will effect what you can do in a post action filter.