private void BindingMethodForCountry()
        {
            try
            {
                using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings[1].ToString()))
                {
                    cn.Open();
                    using (SqlDataAdapter adp = new SqlDataAdapter("Select * from TblCountry", cn))
                    {
                        DataSet ds = new DataSet();
                        adp.Fill(ds);

                        DropDownListCountry.DataSource     = ds;
                        DropDownListCountry.DataValueField = "CountryId";
                        DropDownListCountry.DataTextField  = "CountryName";
                        DropDownListCountry.DataBind();

                        DropDownListCountry.Items.Insert(0, new ListItem("-----------Select Country-----------", "0"));
                        DropDownListState.Items.Insert(0, new ListItem("------------Select State------------", "0"));
                        DropDownListCity.Items.Insert(0, new ListItem("-------------Select City-------------", "0"));

                        if (DropDownListCountry.SelectedValue == "0")  //If Country is not selected then clear State DropDownList
                        {
                            DropDownListState.Items.Clear();
                            DropDownListState.Items.Insert(0, new ListItem("------------Select State------------", "0")); //index, listItem item(text,value)
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Beispiel #2
0
 /// <summary>
 /// The Method that get called on Country DropDownList selection Changed
 /// </summary>
 /// <param name="sender">Event Source</param>
 /// <param name="eventArgument">Event Data</param>
 protected void DropDownListCountry_SelectedIndexChanged(object sender, EventArgs eventArgument)
 {
     GetStates();
     PanelManageState.Visible = false;
     TextBoxStateName.Text    = "";
     DropDownListCountry.Focus();
 }
Beispiel #3
0
 /// <summary>
 /// The Method that get called on Cancel Button Click Event
 /// </summary>
 /// <param name="sender">Event Source</param>
 /// <param name="eventArgument">Event Data</param>
 protected void ButtonCancel_Click(object sender, EventArgs eventArgument)
 {
     GetStates();
     PanelManageState.Visible = false;
     TextBoxStateName.Text    = "";
     DropDownListCountry.Focus();
 }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //used to call the method from FetchCountries
         DropDownListCountry.DataSource = Countries.country_name_list();
         DropDownListCountry.DataBind();
     }
 }
        public void BindCountries()
        {
            CountryCache cache             = new CountryCache(this.Context);
            List <CSBusiness.Country> list = (List <CSBusiness.Country>)cache.Value;

            DropDownListCountry.DataSource     = list;
            DropDownListCountry.DataTextField  = "Name";
            DropDownListCountry.DataValueField = "CountryId";
            DropDownListCountry.DataBind();
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtStartDate.Text = System.DateTime.Now.ToString("MM/dd/yyyy");


                // Categories
                List <JsonCintGeneral> categories;

                if (Session["ListCategories"] == null)
                {
                    categories = JsonConvert.DeserializeObject <List <JsonCintGeneral> >(jsonGET("https://api.cintworks.net/ordering/reference/survey/categories"));
                    Session["ListCategories"] = categories;
                }
                else
                {
                    categories = (List <JsonCintGeneral>)Session["ListCategories"];
                }

                List <JsonCintGeneral> categoriesSortedList = categories.OrderBy(o => o.name).ToList();

                DropDownListCategory.DataSource     = categoriesSortedList;
                DropDownListCategory.DataTextField  = "name";
                DropDownListCategory.DataValueField = "id";
                DropDownListCategory.DataBind();

                List <JsonCintGeneral> countries;


                if (Session["ListCountries"] == null)
                {
                    countries = JsonConvert.DeserializeObject <List <JsonCintGeneral> >(jsonGET("https://api.cintworks.net/ordering/reference/countries"));
                    Session["ListCountries"] = countries;
                }
                else
                {
                    countries = (List <JsonCintGeneral>)Session["ListCountries"];
                }

                List <JsonCintGeneral> countriesSortedList = countries.OrderBy(o => o.name).ToList();
                DropDownListCountry.DataSource     = countriesSortedList;
                DropDownListCountry.DataTextField  = "name";
                DropDownListCountry.DataValueField = "id";
                DropDownListCountry.DataBind();

                DropDownListCountry.SelectedValue = "22";
            }
        }
Beispiel #7
0
        /// <summary>
        /// Gets the list of Countries
        /// </summary>
        private void GetCountries()
        {
            SqlDataReader drCountries = DataProvider.GetCountryList();

            DropDownListCountry.DataSource     = drCountries;
            DropDownListCountry.DataTextField  = "COUNTRY_NAME";
            DropDownListCountry.DataValueField = "COUNTRY_ID";
            DropDownListCountry.DataBind();
            ListItem blankCountry = DropDownListCountry.Items.FindByValue("-1");

            if (blankCountry != null)
            {
                DropDownListCountry.Items.Remove(blankCountry);
            }
            drCountries.Close();
        }
Beispiel #8
0
        /// <summary>
        /// The Method that get called on Page Load Event
        /// </summary>
        protected void Page_Load(object sender, EventArgs eventArgument)
        {
            DataProvider.AuthorizeUser();
            MasterPage masterPage = this.Page.Master;
            Header     headerPage = (Header)masterPage;

            headerPage.DisplayDataFromMasterPage(Session["UserName"].ToString());
            //Session["EnableProductSelection"] = false;
            //Session["AddAllOption"] = "As Selected";
            headerPage.DisplayProductSelectionControl(false);
            GetMasterPage().FindControl("PanelActionMessage").Visible = false;


            if (!Page.IsPostBack)
            {
                GetCountries();
                GetStates();
                DropDownListCountry.Focus();
            }
        }
Beispiel #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!Page.IsPostBack)
         {
             ErpDataContext db        = new ErpDataContext();
             DataTable      dtCountry = new DataTable();
             var            result    = db.SpCountry();
             dtCountry = Globals.ObtainDataTableFromIEnumerable(result);
             DropDownListCountry.DataSource     = dtCountry;
             DropDownListCountry.DataValueField = "CountryName";
             DropDownListCountry.DataTextField  = "CountryName";
             DropDownListCountry.DataBind();
             DropDownListCountry.Items.Insert(0, new ListItem("Select Country", ""));
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #10
0
        private bool IsValidData()
        {
            if (ButtonRegister.Text == "Update")
            {
                if (string.IsNullOrEmpty(TextBoxSupId.Text))
                {
                    Globals.MessageBoxShow(this, "Please Choose a Customer to Edit");
                    TextBoxSupId.Focus();
                    return(false);
                }
            }

            if (string.IsNullOrEmpty(TextBoxSupName.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter Customer Name");
                TextBoxSupName.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(TextBoxZipCode.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter Zip Code");
                TextBoxZipCode.Focus();
                return(false);
            }
            else
            {
                string zipCodePattern = @"[0-9]{6}";
                bool   isZipValid     = true;
                isZipValid = Regex.IsMatch(TextBoxZipCode.Text, zipCodePattern);
                if (!isZipValid)
                {
                    Globals.MessageBoxShow(this, "Please Enter Valid Zip Code");
                    TextBoxZipCode.Focus();
                    return(false);
                }
            }
            if (string.IsNullOrEmpty(TextBoxSupPhno.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter Phone Number");
                TextBoxSupPhno.Focus();
                return(false);
            }
            else
            {
                string phnoPattern = @"[0-9]{10}";
                bool   isphnoValid = true;
                isphnoValid = Regex.IsMatch(TextBoxSupPhno.Text, phnoPattern);
                if (!isphnoValid)
                {
                    Globals.MessageBoxShow(this, "Please Enter Valid Phone Number");
                    TextBoxSupPhno.Focus();
                    return(false);
                }
            }
            if (string.IsNullOrEmpty(TextBoxEmail.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter Email");
                TextBoxEmail.Focus();
                return(false);
            }
            else
            {
                string emailPattern = @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
                bool   isemailValid = true;
                isemailValid = Regex.IsMatch(TextBoxEmail.Text, emailPattern);
                if (!isemailValid)
                {
                    Globals.MessageBoxShow(this, "Please Enter Valid Email");
                    TextBoxEmail.Focus();
                    return(false);
                }
            }
            if (string.IsNullOrEmpty(TextBoxGSTNo.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter GST No");
                TextBoxGSTNo.Focus();
                return(false);
            }
            else
            {
                string gstPattern = @"^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$";
                bool   isgstValid = true;
                isgstValid = Regex.IsMatch(TextBoxGSTNo.Text, gstPattern);
                if (!isgstValid)
                {
                    Globals.MessageBoxShow(this, "Please Enter Valid GST No");
                    TextBoxGSTNo.Focus();
                    return(false);
                }
            }
            if (string.IsNullOrEmpty(TextBoxState.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter State");
                TextBoxState.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(TextBoxCity.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter City");
                TextBoxCity.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(TextBoxAddress.Text))
            {
                Globals.MessageBoxShow(this, "Please Enter Address");
                TextBoxAddress.Focus();
                return(false);
            }
            if (DropDownListCountry.SelectedItem.Text == "Select Country")
            {
                Globals.MessageBoxShow(this, "Please Select Country");
                DropDownListCountry.Focus();
                return(false);
            }
            if (DropDownListGender.SelectedItem.Text == "Gender")
            {
                Globals.MessageBoxShow(this, "Please Select Gender");
                DropDownListGender.Focus();
                return(false);
            }
            return(true);
        }
Beispiel #11
0
 // DropDownList DropDownListCountry;
 protected void Page_Load(object sender, EventArgs e)
 {
     DropDownListCountry.DataSource = GetCountry();
     DropDownListCountry.DataBind();
 }
 /// <summary>
 /// The Method that get called on Country DropDownList selection Changed
 /// </summary>
 /// <param name="sender">Event Source</param>
 /// <param name="eventArgument">Evetn Data</param>
 protected void DropDownListCountry_SelectedIndexChanged(object sender, EventArgs eventArgument)
 {
     GetStates();
     DropDownListCountry.Focus();
 }