|
 |
aspx_beginners thread: SelectedIndexChanged event not firing on DropDownList
Message #1 by "Jamie Barger" <jbarger@l...> on Wed, 10 Apr 2002 22:46:36
|
|
I cannot seem to get the SelectedIndexChanged event to fire for my
DropDownList boxes.
For example, I have a Web Form with only two elements -- a TextBox and a
DropDownList. The DropDownList has three items (which I added via the
Properties window, Items collection). The Web Form has the following code,
which should display the value of the selected item in the TextBox every
time the user changes the selected item. But, this never happens.
To test this further, I later placed a button on the page which assigns
the selected item's value to the text box when clicked. This works. But,
the DropDownList change event never seems to fire -- in spite of the fact
that every tutorial indicates that it will. Is this a bug?
Here's the code from the page. Why doesn't this work as expected?
' ========= the code snippet ============
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
TextBox1.Text = DropDownList1.SelectedItem.Value
End Sub
Message #2 by "Minh T. Nguyen" <nguyentriminh@y...> on Wed, 10 Apr 2002 14:46:05 -0700
|
|
Jamie,
Did you set the DropDownList's AutoPostBack property to true?
Minh.
-----Original Message-----
From: Jamie Barger [mailto:jbarger@l...]
Sent: Wednesday, April 10, 2002 10:47 PM
To: aspx_beginners
Subject: [aspx_beginners] SelectedIndexChanged event not firing on
DropDownList
I cannot seem to get the SelectedIndexChanged event to fire for my
DropDownList boxes.
For example, I have a Web Form with only two elements -- a TextBox and a
DropDownList. The DropDownList has three items (which I added via the
Properties window, Items collection). The Web Form has the following
code,
which should display the value of the selected item in the TextBox every
time the user changes the selected item. But, this never happens.
To test this further, I later placed a button on the page which assigns
the selected item's value to the text box when clicked. This works. But,
the DropDownList change event never seems to fire -- in spite of the
fact
that every tutorial indicates that it will. Is this a bug?
Here's the code from the page. Why doesn't this work as expected?
' ========= the code snippet ============
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
TextBox1.Text = DropDownList1.SelectedItem.Value
End Sub
Message #3 by "Jon Maz" <jonmaz@s...> on Wed, 10 Apr 2002 23:45:58
|
|
Hi,
I saw a thread on the same topic at this URL - maybe the solution there
applies to you...
http://www.aspmessageboard.com/forum/aspplus.asp?M=384590&F=36&P=1
Cheers,
JON
Message #4 by Ashwini.Phalle@l... on Thu, 11 Apr 2002 09:44:59 +0530
|
|
try to assign value as
TextBox1.Text = DropDownList1.Items(DropDownList1.SelectedIndex).Value
"Jamie Barger"
<jbarger@l... To: "aspx_beginners"
tar.com> <aspx_beginners@p...>
cc:
04/11/2002 Subject: [aspx_beginners] SelectedIndexChanged
04:16 AM event not firing on DropDownList
Please respond
to
"aspx_beginner
s"
I cannot seem to get the SelectedIndexChanged event to fire for my
DropDownList boxes.
For example, I have a Web Form with only two elements -- a TextBox and a
DropDownList. The DropDownList has three items (which I added via the
Properties window, Items collection). The Web Form has the following code,
which should display the value of the selected item in the TextBox every
time the user changes the selected item. But, this never happens.
To test this further, I later placed a button on the page which assigns
the selected item's value to the text box when clicked. This works. But,
the DropDownList change event never seems to fire -- in spite of the fact
that every tutorial indicates that it will. Is this a bug?
Here's the code from the page. Why doesn't this work as expected?
' ========= the code snippet ============
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
TextBox1.Text = DropDownList1.SelectedItem.Value
End Sub
|
|
 |