I’m trying get text of the selected drop down item
My drop down list is filled of db data
ad.Fill(dt);
drop1.DataSource = dt;
drop1.DataTextField = "zodys";
drop1.DataValueField = "zodys";
drop1.DataBind();
for example: word1, word2, word3, ...
All this is working fine, but when I try get text of the selected item I always get same text (text of the 1 item)
txtZip.Text = drop1.SelectedItem.Text;
I can almost guarantee your problem is that you’re defining the above within
Page_Load()? You need to only do this if you’re not posting back, like so:This ensures that the value is not being reset each time prior to checking the SelectedItem.