indexer les items d'un dropdownlist
Bonjour, je remplit un dropdown list a partir d'une table avec le code suivant
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
protected void charger_nom()
{
String a;
String b;
int d;
b = Request.Params["ste"];
connexion con = new connexion();
con.connecter();
string sqlText = "select * from contact where interlocuteur like '"+b+"'";
OdbcCommand myOdbcCommand = new OdbcCommand(sqlText);
myOdbcCommand.Connection = con.BaseCon;
lcontact.Items.Clear();
lcontact.DataSource = myOdbcCommand.ExecuteReader();
lcontact.DataTextField = "nom";
lcontact.DataValueField = "code_contact";
lcontact.DataBind();
} |
Mon problème c'est que quand je veux recupérer la valeur séléctionnée avc un lcontact.selectedvalue, j'ai toujours la première valeur dans la list meme si je selectionne une autre