protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string CS = ConfigurationManager.ConnectionStrings["ConexionSQL"].ConnectionString;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("SELECT * FROM SUB_CATEGORIA", con);
                    con.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    DropDownListCategoria.DataTextField  = "nombreSubCategoria";
                    DropDownListCategoria.DataValueField = "nombreSubCategoria";
                    DropDownListCategoria.DataSource     = rdr;
                    DropDownListCategoria.DataBind();
                }
            }

            if (!IsPostBack)
            {
                string CS = ConfigurationManager.ConnectionStrings["ConexionSQL"].ConnectionString;
                using (SqlConnection con = new SqlConnection(CS))
                {
                    SqlCommand cmd = new SqlCommand("SELECT * FROM SUB_CATEGORIA", con);
                    con.Open();
                    SqlDataReader rdr = cmd.ExecuteReader();
                    DropDownListInCat.DataTextField  = "nombreSubCategoria";
                    DropDownListInCat.DataValueField = "nombreSubCategoria";
                    DropDownListInCat.DataSource     = rdr;
                    DropDownListInCat.DataBind();
                }
            }
        }
        private void CarregarCategoriasCompeticao(string idCompeticao)
        {
            Regras.Regras get   = new Regras.Regras();
            DtoCompeticao dados = get.GetCompeticaoPorId(int.Parse(idCompeticao));

            HabilitaCampos(dados);
            List <DtoCategoriasCompeticao> list  = get.GetAllCategoriaPorCompeticao(idCompeticao);
            List <DtoCategoriasCompeticao> lista = new List <DtoCategoriasCompeticao>();

            foreach (var l in list)
            {
                DtoCategoriasCompeticao a = new DtoCategoriasCompeticao();
                a.NomeCategoria = l.NrCategoria + " - " + l.NomeCategoria;
                a.IdCategoria   = l.IdCategoria;
                lista.Add(a);
            }

            DropDownListCategoria.DataSource     = lista;
            DropDownListCategoria.DataTextField  = "NomeCategoria";
            DropDownListCategoria.DataValueField = "IdCategoria";
            DropDownListCategoria.DataBind();
            DropDownListCategoria.Items.Insert(0, new ListItem("-Selecione-", "0"));
        }