protected void GridViewModuls_SelectedIndexChanged(object sender, EventArgs e) { LabelTitolModal.Text = "Modificar"; //Rellenaras los datos. GridViewRow row = GridViewModuls.SelectedRow; String id = row.Cells[3].Text; LabelIdModificar.Text = id; moduls_prof modul = BD.ConsultaModul(Convert.ToInt32(id)); String cicle = modul.cursos.cicles.id.ToString(); DropDownList2.ClearSelection(); DropDownList2_CascadingDropDown.SelectedValue = cicle; String id_curs = modul.id_curs.ToString(); DropDownList1.ClearSelection(); DropDownList1_CascadingDropDown.SelectedValue = id_curs; TextBoxModalCodi.Text = modul.codi.ToString(); TextBoxModalNom.Text = modul.nom.ToString(); TextBoxModalHores.Text = modul.hores.ToString(); TextBoxModalHoresLliures.Text = modul.hores_lliures.ToString(); if (modul.id_professor != null) { DropDownListProfesor.ClearSelection(); DropDownListProfesor.Items.FindByValue(modul.id_professor.ToString()).Selected = true; } ButtonNou_ModalPopupExtender.Show(); }
protected void GridViewUF_SelectedIndexChanged(object sender, EventArgs e) { LabelTitolModal.Text = "Modificar"; //Rellenaras los datos. GridViewRow row = GridViewUF.SelectedRow; String id = row.Cells[2].Text; LabelIdModificar.Text = id; ufs uf = BD.ConsultaUF(Convert.ToInt32(id)); String nom = uf.nom.ToString(); TextBoxNomUF.Text = nom; String cicle = uf.moduls_prof.cursos.id_cicle.ToString(); DropDownList3.ClearSelection(); DropDownList3_CascadingDropDown.SelectedValue = cicle; String id_curs = uf.moduls_prof.id_curs.ToString(); DropDownList4.ClearSelection(); DropDownList4_CascadingDropDown.SelectedValue = id_curs; String id_modul = uf.id_modul_prof.ToString(); DropDownList5.ClearSelection(); DropDownList5_CascadingDropDown.SelectedValue = id_modul; ButtonNou_ModalPopupExtender.Show(); }
protected void btnAceptarCrear_Click(object sender, EventArgs e) { if (this.IsValid) { int id_cicle = Convert.ToInt32(DropDownList2.SelectedItem.Value.ToString()); int id_curs = Convert.ToInt32(DropDownList1.SelectedItem.Value.ToString()); String codi = TextBoxModalCodi.Text; String nom = TextBoxModalNom.Text; int hores = Convert.ToInt32(TextBoxModalHores.Text); int hores_lliures = Convert.ToInt32(TextBoxModalHoresLliures.Text); int id_profesor = Convert.ToInt32(DropDownListProfesor.SelectedItem.Value.ToString()); if (LabelTitolModal.Text == "Crear") { String respuesta = BD.AltaModulProfesional(id_cicle, id_curs, codi, nom, hores, hores_lliures, id_profesor); if (respuesta != "") { LabelErrorBD.Text = respuesta; ButtonNou_ModalPopupExtender.Show(); } else { LimpiarPopUp(); } } else { int id = Convert.ToInt32(LabelIdModificar.Text); String respuesta = BD.ModificarModulProfesional(id, id_cicle, id_curs, codi, nom, hores, hores_lliures, id_profesor); if (respuesta != "") { LabelErrorBD.Text = respuesta; ButtonNou_ModalPopupExtender.Show(); } else { LimpiarPopUp(); } } BD.Refrescar("moduls_prof"); RefrescarGrid(); } else { ButtonNou_ModalPopupExtender.Show(); } }
protected void btnAceptarCrear_Click(object sender, EventArgs e) { if (this.IsValid) { int id_cicle = Convert.ToInt32(DropDownList3.SelectedItem.Value.ToString()); int id_curs = Convert.ToInt32(DropDownList4.SelectedItem.Value.ToString()); int id_modul = Convert.ToInt32(DropDownList5.SelectedItem.Value.ToString()); String nom = TextBoxNomUF.Text; if (LabelTitolModal.Text == "Crear") { String respuesta = BD.AltaUF(id_modul, nom); if (respuesta != "") { LabelErrorBD.Text = respuesta; ButtonNou_ModalPopupExtender.Show(); } else { LimpiarPopUp(); } } else { int id = Convert.ToInt32(LabelIdModificar.Text); String respuesta = BD.ModificarUF(id, id_modul, nom); if (respuesta != "") { LabelErrorBD.Text = respuesta; ButtonNou_ModalPopupExtender.Show(); } else { LimpiarPopUp(); } } BD.Refrescar("ufs"); RefrescarGrid(); } else { ButtonNou_ModalPopupExtender.Show(); } }