Example #1
0
        protected void GVOrcamento_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         index = Convert.ToInt32(e.CommandArgument);
            GridViewRow row   = GVOrcamento.Rows[index];

            int id = Convert.ToInt32(row.Cells[0].Text);

            var db = new OrcamentoDB();

            if (e.CommandName == "Excluir")
            {
                db.Delete(id);
                LoadGrid();
            }
            else if (e.CommandName == "Editar")
            {
                Model.Orcamento orcamento = db.SelectById(id);

                TxtDtInicio.Text  = orcamento.DtInicio;
                TxtDtFim.Text     = orcamento.DtFim.ToString();
                TxtDescricao.Text = orcamento.Descricao.ToString();
                TxtTitulo.Text    = orcamento.Titulo.ToString();
                DdlModulo.Text    = orcamento.Modulo.ToString();
                IdH.Value         = orcamento.Id.ToString();
            }
        }