Just Sharing Info (ASP.Net C#) – save here

Just Sharing Info (ASP.Net C#)
——————————————-
This is one of the best way to check if a drop down list contains a value:

string dataFromDb = “2”;

if (ddlModeOfStudy.Items.FindByValue(dataFromDb) != null)
{
ddlModeOfStudy.SelectedValue = dataFromDb;
}