protected void Page_Load(object sender, EventArgs e) { try { AlunoDAL d = new AlunoDAL(); gridUsuario.DataSource = d.Listar(); //POPULAR A GRID gridUsuario.DataBind(); //EXIBIR O CONTEUDO NO GRID } catch (Exception ex) { lblMensagem.Text = ex.Message; } }
private void CarregarGridView() { try { int IdUsuario = Convert.ToInt32(txtIdUsuario.Text); int IdCurso = Convert.ToInt32(ddl.SelectedItem.Value); AlunoDAL aDAL = new AlunoDAL(); gridAlunos.DataSource = aDAL.Listar(IdUsuario, IdCurso); gridAlunos.DataBind(); } catch (Exception ex) { lblmensagemFalse.Text = ex.Message; } }
protected void ddlCurso_SelectedIndexChanged(object sender, EventArgs e) { try { if (!String.IsNullOrEmpty(ddlCurso.SelectedValue)) { int IdUsuario = Convert.ToInt32(txtIdUsuario.Text); int IdCurso = Convert.ToInt32(ddlCurso.SelectedItem.Value); AlunoDAL aDAL = new AlunoDAL(); ddlAluno.DataSource = aDAL.Listar(IdUsuario, IdCurso); ddlAluno.DataBind(); } } catch (Exception ex) { throw new Exception("Erro ao listar Cursos" + ex.Message); } }
private void CarregarAlunos() { try { if (!(IsPostBack)) { int IdUsuario = Convert.ToInt32(txtIdUsuario.Text); int IdCurso = Convert.ToInt32(ddlCurso.SelectedItem.Value); AlunoDAL aDAL = new AlunoDAL(); ddlAluno.DataSource = aDAL.Listar(IdUsuario, IdCurso); ddlAluno.DataBind(); } } catch (Exception ex) { throw new Exception("Erro ao listar Cursos" + ex.Message); } }