Hi Robert,
Thank you for posting in the community!
Based on my understanding, you meet the text matching problem in
DropDownList.
That is: The Country text in your dropdownlist is "France", while the
maching text from the customer may be "France" or "FRANCE". Then the
"France" matches well, but "FRANCE" does not match.
======================================================
I think the behavior depends on your text matching implementation. How do
you implement your program logic?
I suppose you loop through all the items in the DropDownList and use
ListItem.Text property to match.
So I wrote a sample project like this:
1). The items in the DropDownList are:
USA
France
England
Canada
2). Match code:
private void Button1_Click(object sender, System.EventArgs e)
{
string matchingstr="France";
for(int i=0; i<DropDownList1.Items.Count;i++)
{
if(DropDownList1.Items
.Text.Equals(matchingstr))
{
DropDownList1.SelectedIndex=i;
}
}
}
But using matchingstr="FRANCE" will fail.
So I think you can use String class to make them the same lower-case or
upper-case:
private void Button1_Click(object sender, System.EventArgs e)
{
string matchingstr="FRANCE";
for(int i=0; i<DropDownList1.Items.Count;i++)
{
if(DropDownList1.Items.Text.ToLower().Equals(matchingstr.ToLower()))
{
DropDownList1.SelectedIndex=i;
}
}
}
This will work.
If I misunderstand you, please feel free to tell me.
==========================================================
Please apply my suggestion above and let me know if it helps resolve your
problem.
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.