Avatar of haloexpertsexchange
Flag for United States of America

asked on 

.net dropdownlist when does it get populated with data?

I am dynamically setting a dropdown current index in the page_load event and then after that I try to use the currentindex in a function that is called from the page_load event, but when looking at the page index in the function it always comes up as -1. I used the immediate window in debug mode in visual studios to look up the dropdown item count and it comes up as 0. Which to me says that the dropdown has not yet been populated with data to even have its currentindex set or looked up yet.

When does a dropdown list populate with data so that I can use it as I want?

This was driving me nuts trying to figure what the issue was that was causing the index to always show up as -1 even though I can set the selected index to another number and then the dropdown would show the correct item once the page had completely loaded.
Visual Basic.NET.NET ProgrammingASP.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon