First of all the Drop down control should be bind using Dataset .
Please find the code below.
for (int i = 0; i < ddlCountry.Items.Count; i++)
{
if (ddlCountry.Items[i].Text.ToString() == dsCustomer.Tables[0].Rows[0]["CountryName"].ToString().Trim())
{
ddlCountry.ClearSelection();
ddlCountry.Items.FindByText(dsCustomer.Tables[0].Rows[0]["CountryName"].ToString().Trim()).Selected = true;
}
}
No comments :
Post a Comment