Getting Time Zone:
if (!IsPostBack)
{
drpDwnTimeZone.DataSource = GetTimeZones();
drpDwnTimeZone.DataTextField = "Name";
drpDwnTimeZone.DataValueField = "ID";
drpDwnTimeZone.DataBind();
ShowCustomerProfile();
}
public Collection<MyStruct> GetTimeZones()
{
var myClass = new Collection<MyStruct>();
foreach (var timeZoneInfo in TimeZoneInfo.GetSystemTimeZones())
{
myClass.Add(new MyStruct { Name = timeZoneInfo.DisplayName, ID = timeZoneInfo.Id });
}
return myClass;
}
public struct MyStruct
{
public string Name { get; set; }
public string ID { get; set; }
}
No comments:
Post a Comment