Пример #1
0
    private void BindCountries()
    {
        try
        {
            DDLProvince.Items.Clear();
            DDLCity.Items.Clear();

            DataSet ds = _objBoutility.getCountries();
            if (ds.Tables[0].Rows.Count > 0)
            {
                DDLCountry.DataSource     = ds.Tables[0];
                DDLCountry.DataTextField  = "Name";
                DDLCountry.DataValueField = "Id";
                DDLCountry.DataBind();
                DDLCountry.Items.Insert(0, new ListItem("-- Please Select --", "0"));
            }
            else
            {
                DDLCountry.DataSource = null;
                DDLCountry.DataBind();
                DDLCountry.Items.Insert(0, new ListItem("-- Please Select --", "0"));
            }
        }
        catch (Exception ex)
        {
            lblMsg.Text = _objBoutility.ShowMessage("danger", "error", ex.Message);
            ExceptionLogging.SendExcepToDB(ex);
        }
    }
Пример #2
0
        public void BindCountry()
        {
            var       countryService = new CountryService();
            DataTable dtCountry      = countryService.GetCountries();

            DDLCountry.DataSource     = dtCountry;
            DDLCountry.DataTextField  = "CountryName";
            DDLCountry.DataValueField = "Id";
            DDLCountry.DataBind();
            DDLCountry.Items.Insert(0, new ListItem("-请选择-"));
            var regionService = new RegionService();

            GvShowRegion.DataKeyNames = new string[] { "Id" };//讲数据库中的逐渐字段放入GridView控件的DataKeyNames属性中
            GvShowRegion.DataSource   = regionService.GetRegions();
            GvShowRegion.DataBind();
        }
Пример #3
0
 private void LoadCountry()
 {
     try
     {
         conn = DB_Connect.GetConnection();
         conn.Open();
         string         query  = "Select * from Country";
         SqlDataAdapter _sqlda = new SqlDataAdapter(query, conn);
         DataTable      dt     = new DataTable();
         _sqlda.Fill(dt);
         DDLCountry.DataSource     = dt;
         DDLCountry.DataValueField = "CID";
         DDLCountry.DataTextField  = "CountryName";
         DDLCountry.DataBind();
     }
     catch (Exception e)
     {
         Response.Write("Error");
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            txtpayingfee.Attributes.Add("onkeypress", "return NumberOnly()");
            txtDOA.Text    = DateTime.Now.ToString();
            txttotfee.Text = "40000";
            if (!IsPostBack)
            {
                List <string> ls = new List <string>();
                ls.Add("--Select--");
                ls.Add("India");
                ls.Add("USA");
                ls.Add("UK");
                ls.Add("Japan");
                ls.Add("Nigeria");
                ls.Add("Africa");
                DDLCountry.DataSource = ls;
                DDLCountry.DataBind();

                List <string> list = new List <string>();
                list.Add("--Select--");
                list.Add("Hindu");
                list.Add("Muslim");
                list.Add("Christian");
                list.Add("Sikh");
                list.Add("Buddhism");
                list.Add("Anglo Indian");
                DDLReligion.DataSource = list;
                DDLReligion.DataBind();

                List <string> lsCourse = new List <string>();
                lsCourse.Add("--Select--");
                lsCourse.Add("BCA");
                lsCourse.Add("BBM");
                lsCourse.Add("B.Com");
                lsCourse.Add("B.A");
                DDLCourse.DataSource = lsCourse;
                DDLCourse.DataBind();
            }
        }