I have this code for a DropDownList in ASP.Net :
<asp:DropDownList ID="DropDownList2" runat="server" Width="150px"
AutoPostBack="True">
<asp:ListItem Value="Tronc">Tronc Commun</asp:ListItem>
<asp:ListItem Value="Sc_Maths">Bac 1 Sc Maths</asp:ListItem>
<asp:ListItem Value="Sc_Ex">Bac 1 Sc Ex</asp:ListItem>
<asp:ListItem Value="Eco_Ges">Bac 1 Economie et de Gestion</asp:ListItem>
<asp:ListItem Value="MathsA">Bac 2 Sc Maths A</asp:ListItem>
<asp:ListItem Value="P_C">Bac 2 Sc P.C.</asp:ListItem>
<asp:ListItem Value="S_V_T">Bac 2 Sc S.V.T.</asp:ListItem>
</asp:DropDownList>
what i want is the C# code to fill this DropDownList with these same items with the values, the code i was able to do is this but it only fill it with the items but not the values
str = "(...)";
con = new SqlConnection(str);
req = "select Classe, value from contact";
da = new SqlDataAdapter(req, con);
dt = new DataTable();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
DropDownList3.Items.Add(dt.Rows[i][0].ToString());
DropDownList3.Items.Addis this a typo? because from your code the ID isDropDownList2DropDownListsone filled with ASP.Net code (DropDownList2) and the other is the one i want to fill with same items (with their same values) using C#.