C
Craig Buchanan
I've got two dropdownlists on my webusercontrol. Choosing an item from the
first DDL restricts the data displayed in the second DDL.
Unfortunately, in the SelectedIndexChanged event of the first DDL, the
SelectedIndex is -1. I'm not refreshing the contents of the first DDL on
the postback.
When I step thru the code, the Page_Load executes as expected, but I do get
an 'error' in the IDE when I step thru the code immediately after the this
event that reads: 'There is no source code for the current location'. I
don't know if this is affecting things or not. The SelectedIndexChange
event fires next, and indicates that SelectedIndex is -1.
Does anyone know what's happening? Code is below.
Thanks,
Craig Buchanan
<Code>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then BindData()
End Sub
Private Sub BindData()
BindDDL()
End Sub
Private Sub BindDDL()
With Me.DropDownList1
.DataSource = [stuff here]
.DataBind()
End With
End Sub
Private Sub BindLB(ByVal FolderId As Integer)
With ListBox1
.DataSource = [stuff here]
.DataBind()
End With
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
If Me.ListBox1.SelectedIndex > -1 Then
Dim Value As Long = Me.ListBox1.SelectedItem.Value
Dim Text As String = Me.ListBox1.SelectedItem.Text
BindLB(Value)
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListBox1.SelectedIndexChanged
If Me.ListBox1.SelectedIndex > -1 Then
Dim Value As Long = Me.ListBox1.SelectedItem.Value
Dim Text As String = Me.ListBox1.SelectedItem.Text
RaiseEvent ListClicked(Me, New ListControlEventArgs(Value, Text))
End If
End Sub
</Code>
first DDL restricts the data displayed in the second DDL.
Unfortunately, in the SelectedIndexChanged event of the first DDL, the
SelectedIndex is -1. I'm not refreshing the contents of the first DDL on
the postback.
When I step thru the code, the Page_Load executes as expected, but I do get
an 'error' in the IDE when I step thru the code immediately after the this
event that reads: 'There is no source code for the current location'. I
don't know if this is affecting things or not. The SelectedIndexChange
event fires next, and indicates that SelectedIndex is -1.
Does anyone know what's happening? Code is below.
Thanks,
Craig Buchanan
<Code>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then BindData()
End Sub
Private Sub BindData()
BindDDL()
End Sub
Private Sub BindDDL()
With Me.DropDownList1
.DataSource = [stuff here]
.DataBind()
End With
End Sub
Private Sub BindLB(ByVal FolderId As Integer)
With ListBox1
.DataSource = [stuff here]
.DataBind()
End With
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
If Me.ListBox1.SelectedIndex > -1 Then
Dim Value As Long = Me.ListBox1.SelectedItem.Value
Dim Text As String = Me.ListBox1.SelectedItem.Text
BindLB(Value)
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListBox1.SelectedIndexChanged
If Me.ListBox1.SelectedIndex > -1 Then
Dim Value As Long = Me.ListBox1.SelectedItem.Value
Dim Text As String = Me.ListBox1.SelectedItem.Text
RaiseEvent ListClicked(Me, New ListControlEventArgs(Value, Text))
End If
End Sub
</Code>