예제 #1
0
        //Load City
        #region [Load City]

        private void LoadCityDropDown(string p)
        {
            try
            {
                if (DDL_Country.SelectedValue.Equals("Select") && DDL_Country.SelectedValue.Equals(""))
                {
                    msgBox.ShowMessage("Please Select State First !!!", "Information", UserControls.MessageBox.MessageStyle.Critical);
                }
                else
                {
                    DDL_City.DataTextField  = "name";
                    DDL_City.DataValueField = "id";
                    DataSet ds = ViewState["DatasetAll"] as DataSet;

                    DataView dv = new DataView(ds.Tables["City"]);
                    dv.RowFilter        = "sid = " + p;
                    DDL_City.DataSource = dv.ToTable();
                    DDL_City.DataBind();
                    DDL_City.Items.Insert(0, new ListItem(" Select ", "0"));
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
예제 #2
0
 public void clear()
 {
     txtAddress.Text        = "";
     txtContactNo.Text      = "";
     txtEmail.Text          = "";
     txtEmailid.Text        = "";
     txtFaxNo.Text          = "";
     txtPinCode.Text        = "";
     txtUniversityName.Text = "";
     DDL_Country.ClearSelection();
     DDL_State.ClearSelection();
     DDL_City.ClearSelection();
 }
예제 #3
0
    //City
    protected void LoadCityCombo()
    {
        int  intStateID;
        bool blnCheck = int.TryParse(DDL_State.SelectedIndex.ToString(), out intStateID);

        var query = (from m in ObjEntity.Cities
                     where m.StateID == intStateID
                     select m).ToList();

        DDL_City.DataSource     = query;
        DDL_City.DataTextField  = "CityName";
        DDL_City.DataValueField = "CityID";
        DDL_City.DataBind();
        DDL_City.Items.Insert(0, new ListItem("--Select--", "0"));
    }
예제 #4
0
        public void Bind_ddlCity()
        {
            cn.Open();
            SqlCommand    cmd = new SqlCommand("select * from tblDistrict where StateId ='" + DDL_State.SelectedValue + "'", cn);
            SqlDataReader dr  = cmd.ExecuteReader();

            DDL_City.DataSource = dr;
            DDL_City.Items.Clear();

            DDL_City.DataTextField  = "District";
            DDL_City.DataValueField = "DistrictId";
            DDL_City.DataBind();
            cn.Close();

            DDL_City.Items.Insert(0, new ListItem("--Please Select District--", "0"));
        }
예제 #5
0
        // Selected Index Changes
        #region Selected Index Change

        protected void lnkBtnUniversityName_Click(object sender, EventArgs e)
        {
            try
            {
                btnNew.Visible    = false;
                btnSave.Visible   = false;
                btnUpdate.Visible = true;
                btnDelete.Visible = true;

                txtUniversityName.Enabled = true;
                txtAddress.Enabled        = true;

                txtEmail.Enabled = true;

                txtPinCode.Enabled   = true;
                txtContactNo.Enabled = true;
                txtFaxNo.Enabled     = true;

                flpLogo.Enabled     = true;
                DDL_City.Enabled    = true;
                DDL_Country.Enabled = true;
                DDL_State.Enabled   = true;

                lock (this)
                {
                    LinkButton  lnkBtnId = (LinkButton)sender;
                    GridViewRow grdrow   = lnkBtnId.NamingContainer as GridViewRow;
                    ViewState["UniversityId"] = GrdUniversity.DataKeys[grdrow.RowIndex].Values["UniversityId"].ToString();
                    txtUniversityName.Text    = GrdUniversity.DataKeys[grdrow.RowIndex].Values["UniversityName"].ToString();
                    txtAddress.Text           = GrdUniversity.DataKeys[grdrow.RowIndex].Values["Address"].ToString();

                    //LoadCountryDropDown();
                    // DDL_Country.SelectedValue = GrdUniversity.DataKeys[grdrow.RowIndex].Values["Country"].ToString();
                    //LoadStateDropDown(DDL_Country.SelectedValue);
                    //LoadCityDropDown(DDL_State.SelectedValue);
                    // DDL_City.SelectedValue = GrdUniversity.DataKeys[grdrow.RowIndex].Values["City"].ToString();
                    //DDL_Country.SelectedValue = ds.Tables[0].Rows[0]["Country"].ToString();


                    //FETCH COUNTRY,STATE,CITY
                    int id = Convert.ToInt32(ViewState["UniversityId"].ToString());

                    country = db.getDbstatus_Value("select Country from tblUniversity where UniversityId='" + id + "'");
                    //  DDL_Country.Items.FindByValue(CountryId).Selected = true;
                    DDL_Country.ClearSelection();
                    float abc = db.getDb_Value("select CountryId from Country where County='" + country.ToString() + "' ");
                    DDL_Country.SelectedValue = abc.ToString();


                    sta = db.getDbstatus_Value("select State from tblUniversity where UniversityId='" + id + "'");
                    DDL_State.ClearSelection();
                    Bind_ddlState1();
                    float pqr = db.getDb_Value("select StateId from countryState where State='" + sta.ToString() + "'");
                    DDL_State.SelectedValue = pqr.ToString();

                    ci = db.getDbstatus_Value("select City from tblUniversity where UniversityId='" + id + "'");
                    DDL_City.ClearSelection();
                    Bind_ddlCity1();
                    float xyz = db.getDb_Value("select DistrictId from tblDistrict where District='" + ci.ToString() + "'");
                    DDL_City.SelectedValue = xyz.ToString();


                    // DDL_State.Text = state.ToString();
                    //DDL_State.SelectedValue = state.ToString();
                    // DDL_State.SelectedValue = GrdUniversity.DataKeys[grdrow.RowIndex].Values["state"].ToString();



                    txtPinCode.Text   = GrdUniversity.DataKeys[grdrow.RowIndex].Values["PinCode"].ToString();
                    txtEmail.Text     = GrdUniversity.DataKeys[grdrow.RowIndex].Values["Email"].ToString();
                    txtContactNo.Text = GrdUniversity.DataKeys[grdrow.RowIndex].Values["ContactNo1"].ToString();
                    txtFaxNo.Text     = GrdUniversity.DataKeys[grdrow.RowIndex].Values["FaxNo1"].ToString();
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }