ListControl.SelectedValue
Posted by Sebastien Lachance on October 12, 2006
Every time I set the SelectedValue of a DropdownList in ASP.NET, I was checking if the value existed in the control and if it doesn’t, I usually set a default one (creating a new item with a SelectedIndex of -1). I realized that if you set the FormattingEnabled to true, the SelectedIndex will be set to -1. Thus removing the need for the this check.
This property is found on the ListControl class, with the Dropdownlist inherit.
Happy coding !
Posted in .NET, ASP.NET | No Comments »
