You're updating two lists, so make your method
async Task
instead of
async void
, and use
Page.RegisterAsyncTask
:
public async Task RequestorDropDownList() { ... }
public void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Page.RegisterAsyncTask(new PageAsyncTask(RequestorDropDownList));
}
}
NB: MessageBox.Show
won't work in an ASP.NET application. Your code is running on the server, so the message would pop up on the server, where nobody would ever see it.
It might
appear to work when you're debugging the application in Visual Studio. But that's only because, in that specific case, the server and the client are the same computer.
NB2: You're currently adding the items to
RequestorDropDownList
in both loops. I suspect the second loop should be adding them to
RequestorUpdateDropDownList
.