Beispiel #1
0
 //GetStateDetailinCombo is to bind state details to combobox
 public void GetStateDetailinCombo()
 {
     //using DataTable we can get the state details from database and those are bind to combobox
     using (DataTable dt = objm.GetStateDetailinCombo())
     {
         StateRadComboBox.DataSource     = dt;
         StateRadComboBox.DataTextField  = "State";
         StateRadComboBox.DataValueField = "Statenumber";
         StateRadComboBox.DataBind();
         StateRadComboBox.Items.Insert(0, new RadComboBoxItem("--- Select ---", "0"));
     }
 }
Beispiel #2
0
        // CityIDtxtbox_TextChanged event is used to validate the  Citytextbox
        protected void CityIDtxtbox_TextChanged(object sender, EventArgs e)
        {
            string lbl = CityIDtxtbox.Text;

            //Using below expression user can only enter charcters for city
            if (System.Text.RegularExpressions.Regex.IsMatch(CityIDtxtbox.Text, "^[a-zA-Z ]+$"))
            {
                lblErrorMsg.Text = "";
                //set focus to next field
                StateRadComboBox.Focus();
            }
            else
            {
                CityIDtxtbox.Text = CityIDtxtbox.Text.Remove(CityIDtxtbox.Text.Length - 1);
                lblErrorMsg.Text  = ("Enter the Cityname for ex.Dallas ");
            }
        }