I am displaying values from a database into a dropdownlist. but I am unable to get the corresponding values into the DDL.
if (dt.Rows.Count > 0)
{
DataTable dt1 = new DataTable();
dt1 = bll.getnewid(TextBox1.Text);
if (dt1.Rows.Count > 0)
{
Session["pid"] = dt1.Rows[0]["NewidColumn"].ToString();
Session["email"] = dt1.Rows[0]["EmailID"].ToString();
Session["gender"] = dt1.Rows[0]["Gender"].ToString();
Session["mobile"] = dt1.Rows[0]["MobileNo"].ToString();
Session["country"] = dt1.Rows[0]["Country"].ToString();
Session["state"] = dt1.Rows[0]["State"].ToString();
}
and I am displaying like this
DropDownList1.Text = Session["country"].ToString();
DropDownList2.Text = Session["state"].ToString();
I am able to get the country and state values in the datatable. but I am unable to display them in the DDL.