Esempio n. 1
0
        protected int populate_DDL()
        {
            int            val;
            SqlConnection  con = GetSqlCon.GetCon();
            SqlDataAdapter com = new SqlDataAdapter("GetWorkshopNamesByRegion", con);

            com.SelectCommand.CommandType = CommandType.StoredProcedure;
            com.SelectCommand.Parameters.AddWithValue("@param1", DdlRegiao.SelectedValue);
            DataSet ds1 = new DataSet();

            if (com != null)
            {
                com.Fill(ds1);
            }
            con.Open();
            DdlOficinas.DataSource     = ds1;
            DdlOficinas.DataTextField  = "WorkshopName";
            DdlOficinas.DataValueField = "WorkshopName";
            DdlOficinas.DataBind();
            con.Close();

            val = Badges.CountWorkshopsInRegion(DdlRegiao.SelectedValue);
            if (val == -1)
            {
                Response.Redirect("~/Error.aspx");
            }
            return(val);
        }