private void Consultar_Asistencia() { try { _AsistJug.Clear(); DtoAsistencia dto = new DtoAsistencia(); ClassResultV cr = new CTR.CtrAsistencia().Consultar_Jugadores_Asistencia(LabelCodigoHorario.Text); if (!cr.HuboError) { foreach (DtoB dtoB in cr.List) { _AsistJug.Add((DtoAsistencia)dtoB); } GridView1.DataSource = _AsistJug; GridView1.DataBind(); foreach (GridViewRow item in GridView1.Rows) { CheckBox rd1 = (item.Cells[3].FindControl("RadioButton1") as CheckBox); CheckBox rd2 = (item.Cells[4].FindControl("RadioButton2") as CheckBox); CheckBox rd3 = (item.Cells[5].FindControl("RadioButton3") as CheckBox); CheckBox rd4 = (item.Cells[6].FindControl("RadioButton4") as CheckBox); if (item.Cells[2].Text == "P") { rd1.Checked = true; } if (item.Cells[2].Text == "T") { rd2.Checked = true; } if (item.Cells[2].Text == "F") { rd3.Checked = true; } if (item.Cells[2].Text == "J") { rd4.Checked = true; } } } else { GridView1.DataBind(); } } catch { } }
protected void BotonModificarAsistencia_Click(object sender, EventArgs e) { try { DtoAsistencia dt = new DtoAsistencia(); foreach (GridViewRow item in GridView1.Rows) { dt.codJugador = item.Cells[0].Text; dt.codHorarioEntrenamiento = Convert.ToInt32(LabelCodigoHorario.Text); CheckBox rd1 = (item.Cells[3].FindControl("RadioButton1") as CheckBox); CheckBox rd2 = (item.Cells[4].FindControl("RadioButton2") as CheckBox); CheckBox rd3 = (item.Cells[5].FindControl("RadioButton3") as CheckBox); CheckBox rd4 = (item.Cells[6].FindControl("RadioButton4") as CheckBox); if (rd1.Checked) { dt.asistencia = "P"; } else if (rd2.Checked) { dt.asistencia = "T"; } else if (rd3.Checked) { dt.asistencia = "F"; } else if (rd4.Checked) { dt.asistencia = "J"; } ClassResultV cr1 = new CTR.CtrAsistencia().Modificar_Asistencia(dt); } Limpiar(); } catch (Exception ex) { } }