datasource on asp:dropdownlist is null after a postback
-
I have a dropdownlist who's datasource is a ObjectCollection. I have 3 variables within the Object. The Dropdown list works fine and shows the name variable from the object. Below is some code that explains what i'm doing however I get a compiler error that the cast can't be done. int number = ((Object)dropdownlist1.selecteditem).num; For some reason i get a cannot convert a type system.web.ui.listitem to projectname.int Any ideas?
-
I have a dropdownlist who's datasource is a ObjectCollection. I have 3 variables within the Object. The Dropdown list works fine and shows the name variable from the object. Below is some code that explains what i'm doing however I get a compiler error that the cast can't be done. int number = ((Object)dropdownlist1.selecteditem).num; For some reason i get a cannot convert a type system.web.ui.listitem to projectname.int Any ideas?