-
Notifications
You must be signed in to change notification settings - Fork 2.1k
ViewBag doesn't propagate back to parent #861
Comments
For pages that can pop back (e.g. Partial pages \ View Components), the invoking component already creates a new ViewContext. ViewStart, Pages and Layouts need to share the same Layout. This is required for sharing ViewData values (such as title). Fixes #861
For pages that can pop back (e.g. Partial pages \ View Components), the invoking component already creates a new ViewContext. ViewStart, Pages and Layouts need to share the same Layout. This is required for sharing ViewData values (such as title). Fixes #861
@victorhurdugaci - I'll add a check for this in the automation. |
HI @victorhurdugaci, @Praburaj was this issue resolved? When I set ViewBag.Title in the Controller I can see it in my ViewComponent View and Layout meta.
Shouldn't it propagate also to Layout from ViewComponent class or ViewComponent View? If this is intended for ViewComponent what is the way around as I need to display my Title and Description In Layout which get defined in ViewComponent class. Update: I am using Beta7. This is how I call my ViewComponent
When I debug it, just outside this all ViewBags defined in ViewComponent became null. |
I think I have never been aware that Partials and ViewComponents have got its own ViewBags and found a way around from your collagues :) #3143 |
Run MusicStore and look at the title of the page. Notice that the property coming from the ViewBag is empty and the title is " - Music store"
cc @pranavkm - for code
cc @Praburaj - this could be checked as part of the automation
This is blocking the sample I'm working on
The text was updated successfully, but these errors were encountered: