ComboBoxFor for foreign key field in FormPanelFor

I have two entities - Request and Brigade. Each request belongs to one brigade. I found an example https://mvc.ext.net/#/Models/FormPanelFor/
Here is my code
Request.cshtml - It's loads on main page by @Html.partial

System.InvalidOperationException: "The context cannot be used while the model is being created.
This exception may be thrown if the context is used inside the OnModelCreating method or if the same
context instance is accessed by multiple threads concurrently.
Note that instance members of DbContext and related classes are not guaranteed to be thread safe

Before I get to the thread, please take some time to review our guidelines on posting new threads. Your post is mostly alright despite code we can't run on our side, we just missed your code blocks wrapped between [quote][/quote] tags.

Now, to your question, to the best I can infer from what you shared, it seems you may be calling for too early or an async task. You should let the server resolve the result before trying to bind it to components; if you want them to show as part of the page loading process.

If you need delayed tasks you would need to call separate MVC actions/endpoints in ajax request individually (or coordinately).

Just by reading your code blocks, for instance, I'd say you'd need the FormPanelResponse bit of data instead of the FormPanelRequest -- but I'm assuming a lot of thing that may not have anything to do with your scenario here. Just that, instead of a "to-be-resolved request" you need the "provided response" in order to populate the components with the <Component>For() approach.

If you are still unsure how to tread here, I am afraid we would need a runnable (and simplified, please review the threads above, we don't want and are not allowed to have a portion of your proprietary code here, right?) test case. You probably could expand the sample you pointed to use an entity framework query from a statically-defined data (so we don't need database at all). Maybe a mocking framework is what's needed to simplify the world in that test case of yours?