I've been working on some calculators that are rather heavy on the number side, but because of the nature of what these things are, there's some issues that totally surprised me. If you have two values in a dropdown and do a postback, unexpected things happen.
On a page, paste this into the source...
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" >
<asp:ListItem Value="3">ItemA</asp:ListItem>
<asp:ListItem Value="4">ItemB</asp:ListItem>
<asp:ListItem Value="3">ItemC</asp:ListItem>
<asp:ListItem Value="4">ItemD</asp:ListItem>
<asp:ListItem Value="9">ItemE</asp:ListItem>
</asp:DropDownList>
Load it up and watch what happens (select ItemA, then ItemB, ItemC, ItemD, ItemE) and note the behavior. This is because (as I found out) .net keeps track of it in viewstate by value, not index, text or anything else (as demonstrated).
"Why is this a problem? When would you have two values the same, that'll never happen!" - wrong! In front of me is an xml doc with pressure values on it for the project I'm working on -- guess what, the pressure for itemC is the same as itemW, but the names are very different so this is a real world, totally practical reason why this should not work this way.
So how do you fix it? Great question. If I ever come up with a good one, I'll post up an answer ...unless someone else does? I have a feeling it will be saving the index, the value and the text into viewstate or a combination thereof by using an inherited control. Just a thought.