BUG or Functionality? Drop down selected item issue

Today, I am going to argue on an issue / functionality related to item collection and associated controls like drop down, radio button list, list box control, etc... Well, I am not sure if its a functionality/ limitation or a BUG, but its a quite irritating issue that i found and resolved in two complete days.

Firstly, I am going to tell the situation that I was having.There was a requirement to bind the account number as text and account holder as value with drop down. I did it in 5 minutes. Its was not a big task but when I noticed that on post back the drop down is not persisting its value and repositioning to the start index.

The following code was having this issue.

Image1 

In above code the "Text" is number and "Value" is string (duplicate) as there may be a chance the more than one accounts have same title. I then replaces the drop down with radio button list to check the same and interestingly the same behavior was there...

Image2

Image3

Well, in my case, I can't alter the title to make it unique so that control will work fine. What I did is, appended the title with serial number / sequence number.

 Image4

After changing, the behavior was fine.

Image5

So my problem solved. But really, I was quite disturbed with that issue.

The question is Why this behavior is??

Is this due to some limitation?

Why Microsoft didn't provide some Hash based sorting, so that no matter the value is duplicate or not, it should work properly??

I am not blaming Microsoft on this.. May be there is another way to do this or this is known issue or still they didn't thought on it...

I hope this article will be helpful for you. Your suggestions and feedbacks are welcomed.

1 Comment

Comments have been disabled for this content.