Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Data.DataTable dsCustomers = new System.Data.DataTable();
            System.Data.DataTable dsCountry = new System.Data.DataTable();
            WcfCustomersVB.ServiceCustomer client = new WcfCustomersVB.ServiceCustomer();

            dsCustomers = client.GetCustomers(0);
            dsCountry = client.GetCountries();

            //CountryDD.DataSource = dsCountry;
            //CountryDD.DataValueField = "CountryID";
            //CountryDD.DataTextField = "CountryName";
            //CountryDD.DataBind();

            GridView1.DataSource = dsCustomers;
            GridView1.DataBind();
        }
        private void getAddresses(int CustomerID, int AddressID)
        {
            System.Data.DataTable dsCustomerAddress = new System.Data.DataTable();
            WcfCustomersVB.ServiceCustomer client = new WcfCustomersVB.ServiceCustomer();

            if (CustomerID != 0 && AddressID!=0)
            {
                dsCustomerAddress = client.GetCustomerAddress(CustomerID, AddressID);
            }

            dvAddress.DataSource = dsCustomerAddress;
            dvAddress.DataBind();

            if (strCurrentMode=="Insert")
            {
                DropDownList ddCountry = (DropDownList)dvAddress.FindControl("ddCountry" + strCurrentMode);
                DropDownList ddProvince = (DropDownList)dvAddress.FindControl("ddProvince" + strCurrentMode);
                DropDownList ddCity = (DropDownList)dvAddress.FindControl("ddCity" + strCurrentMode);
                ddCountry.AppendDataBoundItems = true;
                try
                {
                    System.Data.DataTable dsCountry = new System.Data.DataTable();

                    dsCountry = client.GetCountries();
                    ddCountry.DataSource = dsCountry;
                    ddCountry.DataTextField = "CountryName";
                    ddCountry.DataValueField = "CountryID";
                    ddCountry.DataBind();
                    ddProvince.Enabled = false;
                    ddCity.Enabled = false;
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                SetupAddressType();
            }
        }
        protected void SetupCountryDD(int SelectCountryVal= 0)
        {
            DropDownList ddCountry = (DropDownList)dvAddress.FindControl("ddCountry" + strCurrentMode);
            ddCountry.AppendDataBoundItems = true;
            try
            {
                System.Data.DataTable dsCountry = new System.Data.DataTable();
                WcfCustomersVB.ServiceCustomer client = new WcfCustomersVB.ServiceCustomer();

                dsCountry = client.GetCountries();
                ddCountry.DataSource = dsCountry;
                ddCountry.DataTextField = "CountryName";
                ddCountry.DataValueField = "CountryID";
                ddCountry.DataBind();
                ddCountry.SelectedValue = SelectCountryVal.ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }