I have a DropDownList called Sale that I fill in as follows:
DataRow fila = dtr.Rows[0];
OdbcCommand cmd = new OdbcCommand("SELECT A.CardCode, A.CardName, B.SlpName FROM OCRD A INNER JOIN OSLP B ON A.SlpCode = B.SlpCode WHERE B.SlpCode ='" + Convert.ToString(fila["SlpCode"]) + "' AND LicTradNum = 'XAXX010101000'", cn);
OdbcDataAdapter daa = new OdbcDataAdapter(cmd);
DataTable ds = new DataTable();
daa.Fill(ds);
VENTA.DataSource = ds;
VENTA.DataTextField = "CardName";
VENTA.DataValueField = "CardCode";
VENTA.DataBind();
I assign the CardCode to each Item as value . My intention is to show CardCode in a Label, depending on the Item that was selected and this through the Click event of a Button.