I am not able to understand what is happening in this code below. You can see the complete code after this code particularly after populating and binding to the dropdownlist.if (Profile.JobSeeker.ResumeID != -1)
{
ListItem li;
li = ddlCountry.Items.FindByValue(r.CountryID.ToString());
if (li != null)
{
ddlCountry.ClearSelection();
li.Selected = true;
}
li = ddlRelocationCountry.Items.FindByValue(r.RelocationCountryID.ToString());
if (li != null)
{
ddlRelocationCountry.ClearSelection();
li.Selected = true;
}
}
-----------------------------------------------------------Complete code-------------
private
void FillCountries()
{
ddlCountry.DataSource = Country.GetCountries();
ddlCountry.DataTextField =
"CountryName";ddlCountry.DataValueField = "CountryID";
ddlCountry.DataBind();
ddlRelocationCountry.DataSource = Country.GetCountries();
ddlRelocationCountry.DataTextField =
"CountryName";ddlRelocationCountry.DataValueField = "CountryID";
ddlRelocationCountry.DataBind();
if (Profile.JobSeeker.ResumeID != -1)
{
ListItem li;
li = ddlCountry.Items.FindByValue(r.CountryID.ToString());
if (li != null)
{
ddlCountry.ClearSelection();
li.Selected = true;
}
li = ddlRelocationCountry.Items.FindByValue(r.RelocationCountryID.ToString());
if (li != null)
{
ddlRelocationCountry.ClearSelection();
li.Selected = true;
}
}
}