In my MVC app I have one action available on a public side so everything looks like http://www.domain.com/pagename
When it goes to the action method of my WebPageController it finds it in the DB by pagename and renders the View.
In the View I do a database call to a foreign key table called WebPageContent. For each WebPageContent I do a RenderPartial(WebPageContentItem.ControlType)
This works for the most part, I now have a need to have http://www.domain.com/pagename/idofsomething
I have made the changes relevant and the Controller is firing it. What I want to do is if the ID is passed to the Controller I need to get it to my RenderPartial call. I have got it working by setting the ID via ViewData but didn't know if that was the best approach?
Controller->ViewData->View->RenderPartial("Name",Model,ViewData)
In the actual UserControl can you read the action parameter or get it from ViewContext or similar?
In my RenderPartial I can then make a DB call to find the relevant item by the passed ID and then render relevant HTML from the DB object.