Esempio n. 1
0
        protected void gvCities_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditCity")
            {
                int       cityID    = Convert.ToInt32(e.CommandArgument);
                DataTable cityTable = AdminDb.GetCityByID(cityID);
                DataRow   row       = cityTable.Rows[0];
                lbCityID.Text       = cityID.ToString();
                lbCityName.Text     = row["CityName"].ToString();
                lbStateID.Text      = row["StateID"].ToString();
                lbStateName.Text    = row["StateName"].ToString();
                cbMajorCity.Checked = Convert.ToBoolean(row["MajorCity"]);

                //make modal visible and backdrop
                pnlCityEdit.Visible = true;
                pnlBackdrop.Visible = true;
            }
            else if (e.CommandName == "DeleteCity")
            {
                int cityID = Convert.ToInt32(e.CommandArgument);
                AdminDb.DeleteListing(cityID);
                BindDataToGridView();
            }
        }