protected void gridAptosPagamento_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            string param = Request.Params["__CALLBACKPARAM"];

            if (param.Contains("|CUSTOMCALLBACK") || param.Contains("|PAGERONCLICK") || param.Contains("|SORT") || param.Contains("|COLUMNMOVE") || param.Contains("|EXPANDROW") || param.Contains("|COLLAPSEROW") || param.Contains("|SHOWDETAILROW"))
            {

                Control.AgendaPagamentos.Dados obj = new Control.AgendaPagamentos.Dados();

                string envolvido = string.Empty;
                string undOrc = string.Empty;
                DateTime dataIni = DateTime.MinValue;
                DateTime dataFim = DateTime.MaxValue;
                string procNumero = string.Empty;
                string empenho = string.Empty;

                if (cbbEnvolvido.Value != null) envolvido = cbbEnvolvido.Value.ToString();
                if (cbbUndOrc.Value != null) undOrc = cbbUndOrc.Value.ToString();
                if (dtCadastroIni.Value != null) dataIni = dtCadastroIni.Date;
                if (dtCadastroFim.Value != null) dataFim = dtCadastroFim.Date;
                if (txtProcessoNumero.Value != null) procNumero = txtProcessoNumero.Value.ToString();
                if (txtEmpenho.Value != null) empenho = txtEmpenho.Value.ToString();

                DataTable dt = obj.gridAptoPagamento(envolvido, undOrc, dataIni, dataFim, procNumero, empenho);
                gridAptosPagamento.DataSource = dt;
                gridAptosPagamento.DataBind();
                Session["GRIDAPTOSPAGAMENTO"]=  dt;
            }
        }
        protected void gridAptosPagamento_Init(object sender, EventArgs e)
        {
            if (Page.IsCallback)
            {
                string param = Request.Params["__CALLBACKPARAM"];
                string target = Request.Form["__EVENTTARGET"];

                if (!param.Contains("|CUSTOMCALLBACK") && !param.Contains("CBCF") && !param.Contains("|ROWVALUES"))
                {
                    Control.AgendaPagamentos.Dados obj = new Control.AgendaPagamentos.Dados();

                    string  envolvido   = string.Empty;
                    string undOrc       = string.Empty;
                    DateTime dataIni    = DateTime.MinValue;
                    DateTime dataFim    = DateTime.MaxValue;
                    string procNumero   = string.Empty;
                    string empenho      = string.Empty;

                    if (cbbEnvolvido.Value != null) envolvido = cbbEnvolvido.Value.ToString();
                    if (cbbUndOrc.Value != null) undOrc = cbbUndOrc.Value.ToString();
                    if (dtCadastroIni.Value != null) dataIni = dtCadastroIni.Date;
                    if (dtCadastroFim.Value != null) dataFim = dtCadastroFim.Date;
                    if (txtProcessoNumero.Value != null) procNumero = txtProcessoNumero.Value.ToString();
                    if (txtEmpenho.Value != null) empenho = txtEmpenho.Value.ToString();

                    gridAptosPagamento.DataSource = obj.gridAptoPagamento(envolvido, undOrc, dataIni, dataFim, procNumero, empenho);
                    gridAptosPagamento.DataBind();
                }
            }
        }
        protected void ASPxGridViewExporter1_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack || Page.IsCallback)
            {
                string param = Request.Params["__EVENTTARGET"];
                if (param != null)
                {
                    if (param.Contains("btnExcel"))
                    {
                        Control.AgendaPagamentos.Dados obj = new Control.AgendaPagamentos.Dados();

                        string envolvido = string.Empty;
                        string undOrc = string.Empty;
                        DateTime dataIni = DateTime.MinValue;
                        DateTime dataFim = DateTime.MaxValue;
                        string procNumero = string.Empty;
                        string empenho = string.Empty;

                        if (cbbEnvolvido.Value != null) envolvido = cbbEnvolvido.Value.ToString();
                        if (cbbUndOrc.Value != null) undOrc = cbbUndOrc.Value.ToString();
                        if (dtCadastroIni.Value != null) dataIni = dtCadastroIni.Date;
                        if (dtCadastroFim.Value != null) dataFim = dtCadastroFim.Date;
                        if (txtProcessoNumero.Value != null) procNumero = txtProcessoNumero.Value.ToString();
                        if (txtEmpenho.Value != null) empenho = txtEmpenho.Value.ToString();

                        gridAptosPagamento.DataSource = obj.gridAptoPagamento(envolvido, undOrc, dataIni, dataFim, procNumero, empenho);
                        gridAptosPagamento.DataBind();
                    }
                }
            }
        }