Comboxbox's SelectedIndexChanged event not functioning

G

Guest

I have a popup window, which consist of 2 combobox. The second
combobox's(cboCube) item collection will change based on the first
combobox's(cboDatabase) event(selectedindex_changed) is fired. And, I do have
write such code in code-behind as follow:

Private Sub cboDatabase_SelectedIndexChanged(ByVal sender As Object,
ByVal e As System.EventArgs) Handles cboDatabase.SelectedIndexChanged
Dim strAdomdConnectionString As String

Try
With mdtsAnalysisDB.Tables(0).Rows(cboDatabase.SelectedIndex)
strAdomdConnectionString =
BuildAdomdConnectionString(CStr(.Item("ServerName")),
CStr(.Item("AnalysisDBName")), CStr(.Item("UserName")),
CStr(.Item("Password")))
End With

FillCubeCombox(strAdomdConnectionString)

Catch ex As Exception
Throw New ApplicationException(ex.Message.ToString)
End Try
End Sub

Private Sub FillCubeCombox(ByVal pstrAdomdConnectionString As String)
Dim adomdConn As AdomdConnection
Dim cube As CubeDef

Try
adomdConn = New AdomdConnection(pstrAdomdConnectionString)
adomdConn.Open()

cboCube.Items.Clear()

For Each cube In adomdConn.Cubes
cboCube.Items.Add(cube.Caption)
Next

Catch ex As Exception
Throw New ApplicationException(ex.Message.ToString)
End Try
End Sub

But, why my second combobox's(cboCube) item collection won't change, when my
first combobox's(cboDatabase) selectedindex is changed? Besides, I also set
the first combobox's property(AutoPostBack) to true.

Please help... Thanks.

FYI, the following is my Page_Load code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim strAdomdConnectionString As String

Try
If Not Me.IsPostBack Then
Me.btnOK.Attributes.Add("onclick", "Done('" &
txtConnectionString.Text & "');")

FillDatabaseCombobox()

With mdtsAnalysisDB.Tables(0).Rows(cboDatabase.SelectedIndex)
strAdomdConnectionString =
BuildAdomdConnectionString(CStr(.Item("ServerName")),
CStr(.Item("AnalysisDBName")), CStr(.Item("UserName")),
CStr(.Item("Password")))
End With

FillCubeCombox(strAdomdConnectionString)
End If

Catch ex As Exception
Throw New ApplicationException(ex.Message.ToString)
End Try
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top