i have user control, which i render on several views. i want to show viewdata in the usercontrol, but viewdata must be filled in controller method, so i need to fill viewdata on each controller method of each view, where i render usercontrol.
is there any simple solutions?
i have user control, which i render on several views. i want to show
Share
Have a controller for that control like
MenuController
with an action method
If you name your control RenderMenu.ascx, you can just do
Or, maybe it would make more sense to name it Menu.ascx and have a method Menu like this
Your Menu.ascx start would look like this
To use it in a View you do it like this:
HTH