|
|
posted on April 25, 2018 06:06
ListItem lisource = ddlDonationSource.Items.FindByValue(item.Source);
if (lisource != null)
{
// value found - select it
ddlDonationSource.SelectedValue = item.Source;
}
else
{
//Value not found - add it and then select it
ddlDonationSource.Items.Insert(1, new ListItem(item.Source, item.Source));
ddlDonationSource.SelectedValue = item.Source;
}
There are currently no comments, be the first to post one!