<p>I am trying to find out how to use usercontrols in asp.net mvc.  I know how to add a usercontrol to a view and how to pass data to it.  What I haven't been able to figure out is how do you do this without having to retrieve and pass the data in every single controller?</p>

<p>For example, if I have a user control that displays the most recent posts on several but not all the pages in the site, how do I write the Controllers so that I get data for that usercontrol and pass it to the user control from only one place in the web site instead of getting and passing data in each of the different controllers that the user control is used in?</p>

<p>I'm not sure if this makes sense or not.  Is there a better or recommended way to handle an "island" of data that you want to display on several pages?</p>

<p>I'm coming from web forms where I could just write a user control that got its own data and displayed data independently from the rest of whatever page it is used on.</p>

Refactor the code that obtains the view data for this user control into it's own method, maybe even it's own model (class).  Call this method from each controller that needs to populate the control and pass the results in the ViewData with a well-known key.  You might even want to pass the type of the current controller to your method in case it needs to know what data to retrieve based on the base model for the controller.
```
```
ViewData["RecentPosts"] = RecentPosts.GetRecentPosts( this.GetType() );
```
```
In your control, retrieve the data using the well-known key.