I know that you can set set values to a drop down list as the page loads but how do I set the value selected index of a drop down list after the page loads in ASP.NET?
Thanks for the anticipate response.
There are 2 "page loads", one that happens on the server, and one that happens when the page is loaded in the browser (client side).
Which page load are you talking about?
Do you want to do this when the page is loaded client-side?
Or do you want to do this when the page is loaded server-side (maybe after you populate the DropDownList)?
If you want to do it server side there's a couple of different ways you can do it.
You can use the DropDownList's Items property and set the selected index like so:
Code:
myDropDownList.Items(0).Selected = True
Or you could use the DropDownList's Items FindByValue method like so:
Comment