protected void Button1_Click(object sender, EventArgs e) { var tipo = 0; if (rb_rojo.Checked) { tipo = 3; } else if (rb_amarillo.Checked) { tipo = 2; } else if (rb_verde.Checked) { tipo = 1; } if (txt_observacion.Text.Trim() != "") { string add = new HitoBC().add_hito(id_estado, this.txt_observacion.Text, DateTime.Now.ToShortDateString(), tipo); FuncionGlobal.alerta("SUBESTADO, INGRESADO CON EXITO", Page); get_hitos(); this.txt_observacion.Text = ""; } else { FuncionGlobal.alerta("FALTA INGRESAR LA OBSERVACION", Page); } }
protected void get_hitos() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("hito")); dt.Columns.Add(new DataColumn("fecha")); dt.Columns.Add(new DataColumn("tipo")); List <Hito> lhito = new HitoBC().gethito(id_estado); foreach (Hito mhito in lhito) { DataRow dr = dt.NewRow(); dr["hito"] = mhito.Observacion; dr["fecha"] = mhito.Fecha; dr["tipo"] = mhito.Semaforo; dt.Rows.Add(dr); } this.gr_dato.DataSource = dt; this.gr_dato.DataBind(); }