Quote:
This is happening only when DataValueField is same. how to resolve this.
That's a normal behavior of the DropDownList.
As others have mentioned, the
DataValueField
for your
DropDownList
must be unique so that the selection won't messed up. To fix that, use the
shortcode
field as the
DataValueField
. For example:
ddlCurrency.DataSource = dtCurrency;
ddlCurrency.DataTextField = "shortcode";
ddlCurrency.DataValueField = "shortcode";
ddlCurrency.DataBind();
ddlCurrency.Items.Insert(0, "Currency");
Now if you really want to display the
Long Name
field in the page then you can combine both fields and display it as one. That really depends on you. Again, the basic idea here is to make that your
DataValueField
values must be unique and doesn't have duplicate values.