Partial view for frequently used drop down lists I have one input that is needed in many forms, so I created a partial view for that. In the partial view I query the database and generate a drop down list.

I just want to make sure, this is the best way to achieve this.

The partial view looks like this:

@model long?


@{
    var data = Utility.GetData();
}

@Html.DropDownListFor(m =&gt; m, new SelectList((System.Collections.IEnumerable)data, "Id", "Text"),
    new { @class = "form-control input-sm" })


And I'll use it like this:

@Html.EditorFor(x =&gt; x.LiIdPeriod, "Years")


I should note that this is a SPA and intranet application.
I'm new to MVC (relatively), but I don't think I'll ever plan on doing too much in a view. In my understanding, it's merely a template for an object (view model) you throw at it. There shouldn't be much server-side functionality in there at all. Getting data from a database and selecting a SelectList from this collection is too much. There isn't enough separation between concerns of presentation and functionality.

Get that database call into a controller (or better still, a business layer) and keep your views simple. Then you can decide whether you want to call this new action asynchronously or not.