Exemplo n.º 1
0
    //Função editar no Gridview
    protected void grv_alunos_RowEditing(object sender, GridViewEditEventArgs e)
    {
        Aluno_TO AlunoTO = new Aluno_TO();

        try
        {
            AlunoTO.alu_codigo = Convert.ToInt32(grv_aluno.DataKeys[e.NewEditIndex]["alu_codigo"]);

            AlunoTO = new Aluno_BO().GetByCode(AlunoTO);

            txb_nome.Text            = AlunoTO.alu_nome;
            txb_bairro.Text          = AlunoTO.alu_bairro;
            txb_telefone.Text        = Convert.ToString(AlunoTO.alu_telefone);
            txb_data_nascimento.Text = AlunoTO.alu_data_nascimento.ToShortDateString();
            txb_endereco.Text        = AlunoTO.alu_endereco;
            txb_cpf.Text             = AlunoTO.alu_cpf;
            txb_email.Text           = AlunoTO.alu_email;

            ViewState["alu_codigo"] = AlunoTO.alu_codigo;
        }
        catch (Exception)
        {
            throw;
        }
    }
Exemplo n.º 2
0
    protected void LoadGridView()
    {
        Aluno_TO AlunoTO = new Aluno_TO();

        try
        {
            List <Aluno_TO> ListAlunoTO = new Aluno_BO().SearchAll(AlunoTO);

            grv_aluno.DataSource = ListAlunoTO;
            grv_aluno.DataBind();
        }
        catch (Exception)
        {
            throw;
        }
    }