Bonjour tout le monde

Je suis un tout petit peu débutant en asp.net

Au chargement de ma page j'ai deux dropdownlist; je sélectionner les valeurs que je veux et je cliquer sur un butons, au cliquer sur le bouton je veux qu'il m'a additionné les deux valeurs (values) de mes sélectionnes et les afficher sur un label, mais j'ai un Pb ca marche, quand je changer dans le dropdownliste ne se met pas ajoure.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
protected void Page_Load(object sender, EventArgs e)
    {
        {
                MySqlConnection myConnection = new MySqlConnection("Database=mcmaroc; data source=localhost; User Id=root ;Password=;");
                MySqlDataAdapter myAdapter = new MySqlDataAdapter("SELECT * FROM article where code_famille=1 and Afficher=1 and article_machine=1", myConnection);
                DataSet ds = new DataSet();
                myAdapter.Fill(ds, "article");
                DropDownList1.DataSource = ds.Tables[0];
                DropDownList1.DataTextField = "libelle";
                DropDownList1.DataValueField = "pa";
                DropDownList1.DataBind();
        }
{
               MySqlConnection myConnection = new MySqlConnection("Database=mcmaroc; data source=localhost; User Id=root ;Password=;");
               MySqlDataAdapter myAdapter = new MySqlDataAdapter("SELECT * FROM article where code_famille=3 and Afficher=1 and article_machine=1", myConnection);
               DataSet ds = new DataSet();
               myAdapter.Fill(ds, "article");
               DropDownList2.DataSource = ds.Tables[0];
               DropDownList2.DataTextField = "libelle";
               DropDownList2.DataValueField = "pa";
               DropDownList2.DataBind();
           }
 
}
 
protected void Button1_Click(object sender, EventArgs e)
    {
 
 
        {
 
            int resultat = (Convert.ToInt32(DropDownList1.SelectedValue) + Convert.ToInt32(DropDownList2.SelectedValue));
 
            Label1.Text = resultat.ToString();
 
        }
 
    }

merci d'avance