Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
                using (SqlConnection con = new SqlConnection(DbString))
                {
                    String         query = "SELECT City,RouteID From Route";
                    DataTable      dt    = new DataTable();
                    SqlDataAdapter sda   = new SqlDataAdapter(query, con);
                    sda.Fill(dt);
                    if (dt.Columns.Count != 0)
                    {
                        StudentCity.DataSource     = dt;
                        StudentCity.DataTextField  = "City";
                        StudentCity.DataValueField = "RouteID";
                        StudentCity.DataBind();
                    }
                    ListItem liCity = new ListItem("Select City", "-1");
                    StudentCity.Items.Insert(0, liCity);

                    ListItem liRoute = new ListItem("Select Route", "-1");
                    StudentRoute.Items.Insert(0, liRoute);

                    ListItem liStop = new ListItem("Select Stop", "-1");
                    StudentStop.Items.Insert(0, liCity);

                    StudentRoute.Enabled = false;
                    StudentStop.Enabled  = false;
                }
            }
        }
Example #2
0
 // ---- Utility Methods ----
 public int Checksum()
 {
     // hash code of first name, last name, and city (no spaces and all lowercase)
     return((StudentLastName.Replace(" ", "").ToLower() + StudentCity.Replace(" ", "").ToLower() + StudentBirthday.ToString()).GetHashCode());
 }