Esempio n. 1
0
    protected void loadstate()
    {
        if (DropDowncountry.SelectedIndex != 0)
        {
            int conutryId = Convert.ToInt32(DropDowncountry.SelectedValue);

            DataTable dt = mpDetailsBAL.loadState(conutryId);
            DropDownState.DataSource     = dt;
            DropDownState.DataTextField  = "state";
            DropDownState.DataValueField = "stateId";
            DropDownState.DataBind();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));
            string estate = dt1.Rows[0]["state"].ToString();
            DropDownState.Items.FindByText(estate).Selected = true;
            loadconstituency();// to load and select the relevant constituency.

            DropDownpermanentState.DataSource     = dt;
            DropDownpermanentState.DataTextField  = "state";
            DropDownpermanentState.DataValueField = "stateId";
            DropDownpermanentState.DataBind();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));
            string pstate = dt1.Rows[0]["permanentState"].ToString();
            DropDownpermanentState.Items.FindByText(pstate).Selected = true;
            loadpermanentDistrict();

            DropDowncurrentState.DataSource     = dt;
            DropDowncurrentState.DataTextField  = "state";
            DropDowncurrentState.DataValueField = "stateId";
            DropDowncurrentState.DataBind();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));
            string cstate = dt1.Rows[0]["currentState"].ToString();
            DropDowncurrentState.Items.FindByText(cstate).Selected = true;
            loadcurrentDistrict();

            // put party in party combo box.
            dt.Dispose();
            dt = mpDetailsBAL.loadParty(conutryId);
            DropDownparty.DataSource     = dt;
            DropDownparty.DataTextField  = "partyName";
            DropDownparty.DataValueField = "partyId";
            DropDownparty.DataBind();
            DropDownparty.Items.Insert(0, new ListItem("Select Party", "0"));
            string pparty = dt1.Rows[0]["partyName"].ToString();
            DropDownparty.Items.FindByText(pparty).Selected = true;
        }
        else
        {
            DropDownState.Items.Clear();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDownpermanentState.Items.Clear();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDowncurrentState.Items.Clear();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));
        }
    }
Esempio n. 2
0
    protected void DropDowncountry_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDowncountry.SelectedIndex != 0)
        {
            int conutryId = Convert.ToInt32(DropDowncountry.SelectedValue);

            DataTable dt = mpDetailsBAL.loadState(conutryId);
            DropDownState.DataSource     = dt;
            DropDownState.DataTextField  = "state";
            DropDownState.DataValueField = "stateId";
            DropDownState.DataBind();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));

            DropDownpermanentState.DataSource     = dt;
            DropDownpermanentState.DataTextField  = "state";
            DropDownpermanentState.DataValueField = "stateId";
            DropDownpermanentState.DataBind();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));

            DropDowncurrentState.DataSource     = dt;
            DropDowncurrentState.DataTextField  = "state";
            DropDowncurrentState.DataValueField = "stateId";
            DropDowncurrentState.DataBind();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));

            // put party in party combo box.
            dt.Dispose();
            dt = mpDetailsBAL.loadParty(conutryId);
            DropDownparty.DataSource     = dt;
            DropDownparty.DataTextField  = "partyName";
            DropDownparty.DataValueField = "partyId";
            DropDownparty.DataBind();
            DropDownparty.Items.Insert(0, new ListItem("Select Party", "0"));
        }
        else
        {
            DropDownState.Items.Clear();
            DropDownState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDownpermanentState.Items.Clear();
            DropDownpermanentState.Items.Insert(0, new ListItem("Select State", "0"));
            DropDowncurrentState.Items.Clear();
            DropDowncurrentState.Items.Insert(0, new ListItem("Select State", "0"));
        }
    }