How to set a dropdownlist item as selected in ASP.NET?

asp.net, c#

Solution

dropdownlist.ClearSelection(); //making sure the previous selection has been cleared
dropdownlist.Items.FindByValue(value).Selected = true;

Problem

I want to set selecteditem for asp. net dropdownlist control programmatically. So I want to pass a value to the dropdownlist control to set the selected item where is the value of the item equal to the passed value.

Original source

Related problems