I have a WebDropDown that displays a list of names that are in all upper case letters. This is because that is the format of the names from the data source. What is the best method to take each name and convert each to mixed case before I display the list on the page?For example, "SUZIE JONES" should be displayed as "Suzie Jones".Thank you,
Chris
Thank you for your reply. This worked.
Thanks!Chris
Hi cpalko,
Thank you for your reply.
In order for your item strings to be convertited to title case properly, they first should be brought to lower case, i.e. :
For more information on how ToTitleCase operates, please refer to:
http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase.aspx
Please let me know if this helps.
I'm using the DataBound event, it finds the WebDropDown in my ASP Formview. I'm using this Convert_MixedCase method to take in the all upper case text item and convert it to a mixed case text item, but it is not working. Is there a better way to convert each Item?protected void lstPractice_OnDataBound(object sender, EventArgs e){Infragistics.Web.UI.ListControls.WebDropDown primPractice =(Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("lstPractice"); string convertedText = ""; for (int i = 0; i < primPractice.Items.Count; i++) { convertedText = Convert_MixedCase(primPractice.Items[i].Text); primPractice.Items[i].Text = convertedText; }}protected string Convert_MixedCase(string textValue) {System.Globalization.CultureInfo cultureInfo =System.Threading.Thread.CurrentThread.CurrentCulture;System.Globalization.TextInfo textInfo = cultureInfo.TextInfo;return textInfo.ToTitleCase(textValue); }
Hi Chris,
Thank you for posting in the community.
In this scenario I suggest that you handle the DataBound serverside event of WebDropDown in order to implement your text formatting logic. For instance:
protected void WebDropDown1_DataBound(object sender, EventArgs e) { for (int i=0; i < WebDropDown1.Items.Count; i++ ){ WebDropDown1.Items[i].Text = "Formatted text"; } }