Hi nauna,
Check this example. Now please take its reference and correct your code.
HTML
<asp:DropDownList ID="ddlTimeZones" runat="server" AppendDataBoundItems="true">
<asp:ListItem Text="Select" Value="0" />
</asp:DropDownList>
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
List<ListItem> items = new List<ListItem>();
foreach (TimeZoneInfo tzi in TimeZoneInfo.GetSystemTimeZones())
{
items.Add(new ListItem { Text = tzi.DisplayName, Value = tzi.Id });
}
ddlTimeZones.DataSource = items;
ddlTimeZones.DataTextField = "Text";
ddlTimeZones.DataValueField = "value";
ddlTimeZones.DataBind();
if (ddlTimeZones.Items.FindByValue(TimeZone.CurrentTimeZone.StandardName) != null)
{
ddlTimeZones.Items.FindByValue(TimeZone.CurrentTimeZone.StandardName).Selected = true;
}
}
}
VB.Net
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
Dim items As List(Of ListItem) = New List(Of ListItem)
For Each tzi As TimeZoneInfo In TimeZoneInfo.GetSystemTimeZones()
items.Add(New ListItem With {
.Text = tzi.DisplayName,
.Value = tzi.Id
})
Next
ddlTimeZones.DataSource = items
ddlTimeZones.DataTextField = "Text"
ddlTimeZones.DataValueField = "value"
ddlTimeZones.DataBind()
If ddlTimeZones.Items.FindByValue(TimeZone.CurrentTimeZone.StandardName) IsNot Nothing Then
ddlTimeZones.Items.FindByValue(TimeZone.CurrentTimeZone.StandardName).Selected = True
End If
End If
End Sub