Ask a Question related to ASP.NET General, Design and Development.
-
Craig Buchanan #1
parent child dropdownlists acting oddly
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>
Craig Buchanan Guest
-
Parent/Child relations - Trying to access child control for save
I have a parent datagrid that has my customer information. For each customer I have a child datagrid with all their part information. In the... -
removing a child from a parent
is it possible to remove a child from a parent WITHOUT removing it from the world? if I set its parent to VOID it removes it from the world. I want... -
Use Parent Column in Child?
Is there a way to retrieve a column from the parent table of a relationship and display it in the child data control? In my case, I'd like to show a... -
Parent/Child Relationship
Using VS 2003, VB.NET, sql msde... This is really a question about a winform datagridcontrol (if there is a better newsgroup for these winform... -
Transferring from parent to child
I was given some direction about a loop step, but I need help with step syntax within the loop. The following is what I have so far, it presently... -
Craig Buchanan #2
Re: parent child dropdownlists acting oddly
Looks like I'm testing for the listbox1 in the dropdownlist1's event.
Changed the test and everything worked!
"Craig Buchanan" <someone@somewhere.com> wrote in message
news:OXR5wRLPDHA.1748@TK2MSFTNGP11.phx.gbl...the> I've got two dropdownlists on my webusercontrol. Choosing an item fromget> 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 doByVal> 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,As> 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> 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>
>
>
Craig Buchanan Guest



Reply With Quote

