From: MWulfe on
I have a VB2008 website with, among others, 3 dropdownlists. Two of
these are autopostback and unbound, ddlFuel1a and ddlFormulation1.
Whenever I click on any autopostback control, the entire content of
both of these controls is deleted. Other than the Imports and Inherits
lines, the following is the entirety of my VB code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
If Not IsPostBack Then
ddlFuel1a.Items.Add("Gasoline")
ddlFuel1a.Items.Add("Diesel")
ddlFormulation1.Items.Add("All Formulations")
ddlFormulation1.Items.Add("Conventional")
ddlFormulation1.Items.Add("Reformulated")
End If
End Sub

Protected Sub ddlFuel1_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
ddlFuel1a.SelectedIndexChanged
ddlGrade1.Items.Clear() ' Not autopostback
ddlFormulation1.Items.Clear()

If ddlFuel1a.SelectedIndex = 0 Then ' Gasoline
ddlGrade1.Items.Add("All Grades")
ddlGrade1.Items.Add("Regular")
ddlGrade1.Items.Add("Mid Grade")
ddlGrade1.Items.Add("Premium")
ddlGrade1.Text = "All Grades"
ddlFormulation1.Items.Add("All Formulations")
ddlFormulation1.Items.Add("Conventional")
ddlFormulation1.Items.Add("Reformulated")
ddlFormulation1.Text = "All Formulations"
Else
ddlGrade1.Items.Add("No 2 Diesel")
ddlGrade1.Text = "No 2 Diesel"
ddlFormulation1.Items.Add("All Formulations")
ddlFormulation1.Items.Add("Low Sulfur (15-500ppm)")
ddlFormulation1.Items.Add("Ultra Low Sulfur (0-15ppm)")
ddlFormulation1.Text = "All Formulations"
End If

End Sub

Help would be appreciated!!
From: Alexey Smirnov on
On May 18, 12:30 am, MWulfe <mwu...(a)yahoo.com> wrote:
> I have a VB2008 website with, among others, 3 dropdownlists.  Two of
> these are autopostback and unbound, ddlFuel1a and ddlFormulation1.
> Whenever I click on any autopostback  control, the entire content of
> both of these controls is deleted. Other than the Imports and Inherits
> lines, the following is the entirety of my VB code:

I don't see any error here, it looks correct to me. You said, that
ddlFormulation1 has also autopostback on. Do you have any code (a sub)
for this event? Maybe this is a problem?