private void Build() { this.BtnCreate.NavigateUrl = "/Alumno/Create"; var result = new AlumnoBll().Read(); if (result.Count > 0) { this.RptData.ItemDataBound += this.RptData_ItemDataBound; this.RptData.DataSource = result; this.RptData.DataBind(); } else { this.ShowError("No hay elementos.", true); } }
private void Build() { var cursos = new CursoBll().Read(); var alumnos = new AlumnoBll().Read(); foreach (var item in cursos) { this.DdlCurso.Items.Add(new ListItem(item.Nombre, item.Id.ToString())); } foreach (var item in alumnos) { this.DdlAlumno.Items.Add(new ListItem(item.Nombre, item.Id.ToString())); } this.DdlBeca.Items.Add(new ListItem("Regular", ((int)BecaType.Regular).ToString())); this.DdlBeca.Items.Add(new ListItem("Media Beca", ((int)BecaType.MediaBeca).ToString())); this.DdlBeca.Items.Add(new ListItem("80%", ((int)BecaType.Beca80).ToString())); }
protected void BtnCreate_Click(object sender, EventArgs e) { try { var result = new AlumnoBll().Create( new Domain.Alumno() { Nombre = this.TxtName.Text, }); if (result > 0) { this.Response.Redirect("/Alumno", false); } else { this.ShowError("Se produjo un error inesperado, inténtalo de nuevo.", true); } } catch (Exception ex) { this.ShowError(ex.Message, true); } }