Example #1
0
        private void BindTimeZoneDropDown()
        {
            TimeZoneSelection.DataSource     = XrmContext.CreateQuery("timezonedefinition").OrderByDescending(t => t.GetAttributeValue <string>("userinterfacename")).Select(t => new ListItem(t.GetAttributeValue <string>("userinterfacename"), t.GetAttributeValue <int>("timezonecode").ToString(CultureInfo.InvariantCulture)));
            TimeZoneSelection.DataTextField  = "Text";
            TimeZoneSelection.DataValueField = "Value";
            TimeZoneSelection.DataBind();

            TimeZoneSelection.Items.Insert(0, new ListItem("Please Select One..."));

            if (Contact.GetAttributeValue <int?>("adx_timezone").HasValue)
            {
                TimeZoneSelection.SelectedValue = Contact.GetAttributeValue <int?>("adx_timezone").ToString();
            }
        }
        private void BindTimeZoneDropDown()
        {
            TimeZoneSelection.DataSource     = XrmContext.TimeZoneDefinitionSet.OrderByDescending(t => t.UserInterfaceName);
            TimeZoneSelection.DataTextField  = "userinterfacename";
            TimeZoneSelection.DataValueField = "timezonecode";
            TimeZoneSelection.DataBind();

            TimeZoneSelection.Items.Insert(0, new ListItem("Please Select One..."));

            if (Contact.Adx_TimeZone.HasValue)
            {
                TimeZoneSelection.SelectedValue = Contact.Adx_TimeZone.ToString();
            }
        }