I have a dropdownlist in a page. The values of all the list items = "0". I have viewstate turned off. When the page posts back, the selected index always = 1 in Page_load event, regardless of the selection in the list. If the values of the list items are different, the selectedIndex has the proper value. Is this normal behavior?
If dropdownlist becomes an HTML Select List, then yes, the browser submits the value attribute of each option, thus if they are all the same, you will always get the same value.
Well, pretty much. The selectedIndex tells you which option has value that was posted back. Since all of the values are the same, the browser can select any option it likes and it will be correct. The 'interesting' attribute is the value, not the text of the option.
Yes. The values are used to indicate what the selected item is on postback. If all of your items have the same value then it finds the first item that matches the value hence the SelectedIndex = 1.
Practice suggests to use an ID in the value field.
It is the expected behavior. The HTML SELECT element only sends back the value, not the text. If all the OPTIONs have the same value, then it will look like each one is selected, so ASP.Net picks the first one.
If you don't use the value, you can omit it and it will be the same as the text. Or you can explicitly set the value the same as the text. Another alternative would be to use the index of the list item as the value. But unless you use different values (as rendered in HTML), the drop list is more or less useless.