Side dishes: DropDownList control binding data, in the acquisition of data always get to the first item, is depressed, how to, so on all kinds of thinking, have not found the cause of the problem. Take a look at the code in the foreground below:
<asp:dropdownlistID= "Dropdownlistkind"runat= "Server"> </asp:dropdownlist> <BR/> <BR/> <Asp:buttonID= "Button1"runat= "Server"Text= "button"onclick= "Button1_Click" />
Background code:
To seriously look at the above code yo, you can find the problem of the location.
Ha ha!
The answers are now revealed:
All are Dropdownlistkind.datavaluefield = "Kind"; The Curse of the cause
So the value of DropDownList is the same after the binding, so it is not wrong to blame it.
therefore Dropdownlistkind.datavaluefield = "Kind";
Change to Dropdownlistkind.datavaluefield = "Name";
is not suddenly enlightened. Summary: The vaule value of DropDownList should be kept unique. The control is not deeply understood. Do not know the fur, but do not know the structure of the root of it. Study hard, come on! Little rookie.
Why does DropDownList always get the value of the first item???