Asynchronous method calls from the razor view are supported (or will be supported) only in ASP.NET vNext (MVC 6).
If you are using MVC 5 and eralier, the easiest solution to your problem would be to add a property to your view model and populate it with an asynchronous call to db. Therefore, when your view is displayed, all the data will already be in the model and ready for use.
PS , also calling the database from view, sounds a bit suspicious. Perhaps you should consider this template.
source
share