troubleshooting Question

.net dropdownlist when does it get populated with data?

Avatar of haloexpertsexchange
haloexpertsexchangeFlag for United States of America asked on
Visual Basic.NET.NET ProgrammingASP.NET
6 Comments1 Solution440 ViewsLast Modified:
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.
Jerry Miller

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros