private void Bind()
    {
        //List<SelectListItem> list = new List<SelectListItem>();
        DataTable dtEmployee = new DataTable();
        DataTable dtCity     = new DataTable();

        try
        {
            Cls_Employee_b clsEmployee = new Cls_Employee_b();
            dtEmployee = clsEmployee.SelectAll();

            cls_CityMaster_b clscity = new cls_CityMaster_b();
            dtCity = clscity.SelectAll();
        }
        catch { }
        finally { con.Close(); }

        if (dtEmployee != null)
        {
            if (dtEmployee.Rows.Count > 0)
            {
                Session["employee"]        = dtEmployee;
                lstemployee.DataSource     = dtEmployee;
                lstemployee.DataTextField  = "employeeName";
                lstemployee.DataValueField = "id";
                lstemployee.DataBind();
                //System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select Employee--", "0");
                //lstemployee.Items.Insert(0, objListItem);
            }
        }
        lstemployee.SelectedIndex = 0;
        if (dtCity != null)
        {
            if (dtCity.Rows.Count > 0)
            {
                Session["city"]        = dtCity;
                lstCity.DataSource     = dtCity;
                lstCity.DataTextField  = "cityname";
                lstCity.DataValueField = "id";
                lstCity.DataBind();
                //System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select City--", "0");
                //lstCity.Items.Insert(0, objListItem);
            }
        }
        //lstCity.SelectedIndex = 0;
    }
    private void BindStateandCity()
    {
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["cnstring"].ConnectionString);
        SqlCommand    cmd = new SqlCommand();

        cmd.CommandText = "getState_byCountryId";
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@countryid", Convert.ToInt64("1"));
        cmd.Connection = con;
        DataTable dtUser = new DataTable();

        con.Open();
        SqlDataAdapter da = new SqlDataAdapter(cmd);

        da.Fill(dtUser);
        if (dtUser != null)
        {
            if (dtUser.Rows.Count > 0)
            {
                txtSate.DataSource     = dtUser;
                txtSate.DataTextField  = "statename";
                txtSate.DataValueField = "id";
                txtSate.DataBind();
                ListItem objListItem = new ListItem("--Select State--", "-1");
                txtSate.Items.Insert(0, objListItem);
            }
            else
            {
                txtSate.DataSource     = dtUser;
                txtSate.DataTextField  = "statename";
                txtSate.DataValueField = "id";
                txtSate.DataBind();
                ListItem objListItem = new ListItem("--Select State--", "-1");
                txtSate.Items.Insert(0, objListItem);
            }
        }
        else
        {
            txtSate.DataSource     = dtUser;
            txtSate.DataTextField  = "statename";
            txtSate.DataValueField = "id";
            txtSate.DataBind();
            ListItem objListItem = new ListItem("--Select State--", "-1");
            txtSate.Items.Insert(0, objListItem);
        }

        DataTable dtCity = new DataTable();

        try
        {
            cls_CityMaster_b clscity = new cls_CityMaster_b();
            dtCity = clscity.SelectAll();
        }
        catch { }
        finally { con.Close(); }

        if (dtCity != null)
        {
            if (dtCity.Rows.Count > 0)
            {
                Session["city"]        = dtCity;
                lstCity.DataSource     = dtCity;
                lstCity.DataTextField  = "cityname";
                lstCity.DataValueField = "id";
                lstCity.DataBind();
                //System.Web.UI.WebControls.ListItem objListItem = new System.Web.UI.WebControls.ListItem("--Select City--", "0");
                //lstCity.Items.Insert(0, objListItem);
            }
        }
    }