I have some problems on passing an id from URL into my controller action
Lets say I have this Url : Bing/Index/4
In my master page I would like to generate a form that submits to BingController SearchAction. I did something like this
using(Html.BeginForm<BingController>(action => action.Search(id)))
How to get id (4 in this example) from url to pass it to the Search action ?
Thanks for your help
To access that data in a master page, your controllers would need to add it to the ViewData so the master page has access to it.
Then in your master page, you can access it in the ViewData
For a strongly-typed View, I have a BaseModel class that has properties that the master page needs and all my other models inherit the base class. Something like this…
Your master page would look like this: