Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
419
TimeZoneEditor Default Entries
posted

We are using the infragistics 7.2 TimeZoneEditor control to depict the TimeZone in 2.0 app. With TimeZoneInfo class of Infragistics, its easier to depict the timezone in the UI, but when i want to use the stored index in the backend, will i need to initialize the TimeZoneEditor and then based on the selectedIndex get the appropriate TimeZoneInfo object ???

I am sure there is a better way to do this(of which i have no clue yet).

hopefully if i understand how the editor is filled with the values, i would be enlightened.

  • 4940
    Offline posted

    The UltraTimeZoneEditor is pre-populated with the names of time zones from the registry. One way for you to store and restore selected values from the UltraTimeZoneEditor would be to use the StandardName property. Below you'll find a really simple snippet that you can further integrate into your source.

     

                //Retreive the currently selected TimeZoneInfo.
                Infragistics.Win.TimeZoneInfo tzi = ultraTimeZoneEditor1.SelectedItem.DataValue as Infragistics.Win.TimeZoneInfo;
                String standardname = tzi.StandardName;
                //..Store standard name in the backend
    
                //..Pull standard name from the backend, then set the item in UltraTimeZoneEditor
                foreach (ValueListItem vli in ultraTimeZoneEditor1.Items)
                {
                    if (((Infragistics.Win.TimeZoneInfo)vli.DataValue).StandardName == standardname)
                    {
                        ultraTimeZoneEditor1.SelectedItem = vli;
                        break;
                    }
                }