protected void Page_Load(object sender, EventArgs e)
        {
            using (var banco = new Banco())
            {
                GridViewDepudadoFederal.PreRender += GridViewDepudadoFederal_PreRender;
                DataTable dt;

                banco.AddParameter("@ideCadastro", Request.QueryString["id"]);
                dt = banco.GetTable(@"SELECT ideCadastro, txNomeParlamentar, uf, partido, condicao, email, nome
                    FROM parlamentares
						  WHERE ideCadastro=@ideCadastro"                        );
                frvDeputadoFederal.DataSource = dt;
                frvDeputadoFederal.DataBind();

                Master.Page.Title = "OPS :: Dep. " + dt.Rows[0]["txNomeParlamentar"].ToString();

                banco.AddParameter("@ideCadastro", Request.QueryString["id"]);
                dt = banco.GetTable(@"SELECT SUM(vlrLiquido) AS ValorTotal, txtDescricao AS Despesa
                    FROM lancamentos
						  WHERE ideCadastro=@ideCadastro
						  GROUP BY txtDescricao
						  ORDER BY 1 DESC"                        );
                GridViewDepudadoFederal.DataSource = dt;
                GridViewDepudadoFederal.DataBind();
                Session["pesquisa0"] = dt;

                ValorTotal.InnerText = Convert.ToDecimal(dt.Compute("Sum(ValorTotal)", "")).ToString("#,###.00");

                banco.AddParameter("@ideCadastro", Request.QueryString["id"]);
                TotalFuncionarios.InnerText = banco.ExecuteScalar(@"SELECT count(1) FROM secretario WHERE deputado=@ideCadastro").ToString();
            }
        }
        protected void GridViewDepudadoFederal_Sorting(object sender, GridViewSortEventArgs e)
        {
            //Retrieve the table from the session object.
            DataTable dt = Session["pesquisa0"] as DataTable;

            if (dt != null)
            {
                //Sort the data.
                dt.DefaultView.Sort = e.SortExpression + " " + GetSortDirection(e.SortExpression);
                GridViewDepudadoFederal.DataSource = Session["pesquisa0"];
                GridViewDepudadoFederal.DataBind();
            }
        }