Beispiel #1
0
 public void fillcitydetails(Int32 cityid, string streetname, string parent_zip)
 {
     txtaddress.Text = streetname.ToString();
     if (cityid != 0)
     {
         hdncityid.Value = cityid.ToString();
         DataTable dt = new DataTable();
         DataTable dt1 = new DataTable();
         MasterData mdl = new MasterData();
         dt = mdl.Getcitydetails(Convert.ToInt32(hdncityid.Value));
         if (dt.Rows.Count > 0)
         {
             txtaddress.Text = streetname.ToString();
             ddlcity.SelectedIndex = ddlcity.Items.IndexOf(ddlcity.Items.FindByValue(dt.Rows[0]["City_ID"].ToString()));
             lblcountry.Text = dt.Rows[0]["COUNTRY_NAME"].ToString();
             lblstate.Text = dt.Rows[0]["STATE_NAME"].ToString();
             string[] zip = dt.Rows[0]["Zip"].ToString().Split(',');
             dt1.Columns.Add("ZipCode", typeof(string));
             dt1.Columns.Add("Zipid", typeof(Int32));
             for (int i = 0; i < zip.Length; i++)
             {
                 dt1.Rows.Add(zip[i],i);
             }
             objcf.FillDropDownList(ddlzip, dt1, "ZipCode", "Zipid");
             if (parent_zip != "0")
                 ddlzip.SelectedIndex = ddlzip.Items.IndexOf(ddlzip.Items.FindByText(parent_zip));
         }
     }
     else
     {
         clearall();
     }
 }
Beispiel #2
0
 protected void txtcitynearby_TextChanged(object sender, EventArgs e)
 {
     TextBox txtcitynearby = (TextBox)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("txtcitynearby");
     TextBox txtstatenc = (TextBox)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("txtstatenc");
     TextBox txtZipCodenc = (TextBox)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("txtZipCodenc");
     Label lblnearbystate = (Label)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblnearbystate");
     Label lblcountrync = (Label)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblcountrync");
     Label lblzipcodenc = (Label)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblzipcodenc");
     DropDownList ddlstatenc = (DropDownList)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlstatenc");
     DropDownList ddlcountrync = (DropDownList)Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlcountrync");
     MasterData edl = new MasterData();
     List<string> CountryNames = edl.searchcity(txtcitynearby.Text.Trim(), "Y");
     bool flg = false;
     if (CountryNames.Count == 0)
     {
         flg = true;
         hdnnearbycityid.Value = "0";
         hdncountryidnc.Value = "0";
         hdnstateidnc.Value = "0";
     }
     else
     {
         MasterData mdl = new MasterData();
         DataTable dt1 = mdl.Getcitydetails(Convert.ToInt32(hdnnearbycityid.Value));
         lblnearbystate.Text = dt1.Rows[0]["STATE_NAME"].ToString();
         lblcountrync.Text = dt1.Rows[0]["Country_NAME"].ToString();
         txtcitynearby.Text = dt1.Rows[0]["City_name"].ToString();
         lblzipcodenc.Text = dt1.Rows[0]["Zip"].ToString();
         hdncountryidnc.Value = dt1.Rows[0]["Country_ID"].ToString();
         hdnstateidnc.Value = dt1.Rows[0]["State_ID"].ToString();
         txtstatenc.Visible = flg;
         ddlstatenc.ClearSelection();
         ddlcountrync.ClearSelection();
     }
     ddlcountrync.Visible = flg;
     ddlstatenc.Visible = flg;
     lblnearbystate.Visible = !flg;
     lblcountrync.Visible = !flg;
     lblzipcodenc.Visible = !flg;
     txtZipCodenc.Visible = flg;
 }
Beispiel #3
0
        protected void ddlcitynearby_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList ddlcitynearby = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("ddlcitynearby") as DropDownList;

            Label lblnearbystate = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblnearbystate") as Label;
            Label lblcountrync = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblcountrync") as Label;
            Label lblzipcodenc = Repnearbymetro.Controls[Repnearbymetro.Controls.Count - 1].FindControl("lblzipcodenc") as Label;
            DataTable dt = new DataTable();
            if (ddlcitynearby.SelectedItem.Value == hdnmetrocityid.Value)
            {
                lblerrmsg.Text = "Metro city and near by metro city should not be same!";
                ddlcitynearby.ClearSelection();
                return;
            }
            if (ddlcitynearby.SelectedIndex > 0)
            {
                if (cityexist(Convert.ToInt32(ddlcitynearby.SelectedItem.Value)) == false)
                {
                    lblerrmsg.Text = "Near by city already exists!";
                    ddlcitynearby.ClearSelection();
                    return;
                }
                hdnnearbycityid.Value = ddlcitynearby.SelectedItem.Value;
                MasterData mdl = new MasterData();
                dt = mdl.Getcitydetails(Convert.ToInt32(ddlcitynearby.SelectedItem.Value));
                lblcountrync.Text = dt.Rows[0]["COUNTRY_NAME"].ToString();
                lblnearbystate.Text = dt.Rows[0]["STATE_NAME"].ToString();
                lblzipcodenc.Text = dt.Rows[0]["Zip"].ToString();
            }
            else
            {
                lblcountrync.Text = string.Empty;
                lblnearbystate.Text = string.Empty;
                lblzipcodenc.Text = string.Empty;
            }
            ddlcitynearby.Focus();
        }