tag:blogger.com,1999:blog-5611706923356552090.post585993724843293652..comments2024-02-07T23:54:11.846-05:00Comments on C Razor Sharp / C# / .NET: Master Page Model in ASP.NET MVC 3 using Dependency Injection (Unity)A.Friedmanhttp://www.blogger.com/profile/17438995939632438979noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-5611706923356552090.post-1063504409102451542012-01-31T09:46:13.702-05:002012-01-31T09:46:13.702-05:00Great sample, mister Friedman, great !!Great sample, mister Friedman, great !!Kiquenethttps://www.blogger.com/profile/10446364197640116526noreply@blogger.comtag:blogger.com,1999:blog-5611706923356552090.post-26374566418534139582011-07-30T02:29:40.715-04:002011-07-30T02:29:40.715-04:00Hi I am new to MVC 3 and struggling with the same ...Hi I am new to MVC 3 and struggling with the same model in master page issue. with unity.mvc3 there is only only bootstrapper.cs which is added by the package itlself. How do I use this solution in that?Shanhttps://www.blogger.com/profile/01474675813421586520noreply@blogger.comtag:blogger.com,1999:blog-5611706923356552090.post-43227821581511537352011-04-29T16:32:33.726-04:002011-04-29T16:32:33.726-04:00Thanks for the answer. But I don't need to set...Thanks for the answer. But I don't need to set up any data into MasterPageDataSetter, I need to set up them onto page itself, for example something like that:<br /><br />@{Html.RenderPartial("TweetViewPartial", (object)ViewBag.MasterPageModel, new ViewDataDictionary { { "twitId", "brooklynDev" } });}<br /><br />Then partial view will access it. But I need it access somewhere before, and I suppose MasterPageDateSetter will not able to access ViewBag at all. So how could I pass this parameter to process it before partial view itself? Unity resolver can access but the dictionary is always null.<br />ThanksElectric Cathttps://www.blogger.com/profile/10612221757047399211noreply@blogger.comtag:blogger.com,1999:blog-5611706923356552090.post-90048412134292498822011-04-28T20:40:21.528-04:002011-04-28T20:40:21.528-04:00@Electric: Any data that you need in your view, ca...@Electric: Any data that you need in your view, can be set in the MasterPageDataSetter. e.g. In your example, where you have multiple instances of the partial with different twitter handles, well where are the different twitter handles coming from? Let's say it came from some database, then your MasterPageDataSetter would need to be injected with an "ITwitterHandlesRepository" or something like that, and then you set all that data to the ViewBag property. The point I'm making is, any data you need in the view, you can have the appropriate services injected to the MasterPageDataSetter and then feed it along. Makes sense?A.Friedmanhttps://www.blogger.com/profile/17438995939632438979noreply@blogger.comtag:blogger.com,1999:blog-5611706923356552090.post-49917635076569913132011-04-28T19:34:24.169-04:002011-04-28T19:34:24.169-04:00Hello!
Thanks for the very useful topic. But what ...Hello!<br />Thanks for the very useful topic. But what if I need to pass some parameter into partial view, how to do that? For example I want to have several partial views on my layout page, for twitters from different users. It would be great to use the same partial view but I don't imagine how to pass parameter like username, for example, "@brooklynDev", to it?<br />ThanksElectric Cathttps://www.blogger.com/profile/10612221757047399211noreply@blogger.com