title: Determine the model of a partial view from the controller within MVC
body: <p>My current problem is that I have a partial view that I want to determine what model is being used by it. </p>
  
  <p>I have had to deal with a few strange scenarios for my project so I will try to outline it here, maybe someone can offer a better way to do this.</p>
  
  <p>I am designing something like the Google iGoogle page. A main page with multiple widgets that are able to move around or be configured as needed. The current system loads the actual widget's data asynchronously view a POST to a controller within my application. That controller will either render a partial view to HTML that can be returned (and then loaded into the page view JQUERY) or just straight HTML/JavaScript that is stored in a database.</p>
  
  <p>This was working fine for me, I had a model for the widgets that holds a dictionary of options that are described via the database, and then used by the partial view. The problem came when I wanted to pass data to a partial view. The best solution I could come up with was having the controller determine which model the partial view in question uses, have some function that will fill the model, and then pass it, along with the partial view, to the function that will render it to HTML within the controller.</p>
  
  <p>I realize this is an odd scenario for MVC (the layers are blending...) and any advice on fundamental design, or implementation of this would be greatly appreciated.</p>
  
  <p>I am currently using MVC3/Razor. Feel free to ask any other questions.</p>