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> 1 1825
Looks like I'm testing for the listbox1 in the dropdownlist1's event.
Changed the test and everything worked!
"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:OX**************@TK2MSFTNGP11.phx.gbl... 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>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: pablo |
last post by:
Dear NewsGroupers,
I am relatively new to OOP and cannet get my head around this problem.
I have two classes. Class Child extends Parent.
There is no constructor for the Child class. So when I...
|
by: ahaideb |
last post by:
I have a table (relation) in my database:
---------------
| parent | child |
---------------
| 1 | 2 |
| 1 | 3 |
| 2 | 4 |
| 2 | 5 ...
|
by: David Sobey |
last post by:
hi
Here's some code:
void SomeFunc(childClass arg);
....
parentClass a;
a=new childClass();
SomeFunc(a);
|
by: jalkadir |
last post by:
Let's say that I have this class:
class Parent{
private: char* str;
public: const char* getStr(){return str;}
};
And then I create a child class
class Child{
private: std::string str;...
|
by: Steve Jorgensen |
last post by:
Yup, Steve's full of tips, but hey, it makes him feel important, right?
Ok, here goes. I've been trying to improve encapsulation by putting code
in the same object as the stuff it affects, so I...
|
by: Danny Tuppeny |
last post by:
Hi all,
I've been trying to write some classes, so when I have a parent-child
relationship, such as with Folders in my application, I don't have to
remember to add a parent reference, as well as...
|
by: Charles Law |
last post by:
For some reason, when I click the X to close my MDI parent form, the action
appears to be re-directed to one of the MDI child forms, and the parent
remains open. I am then unable to close the...
|
by: jewel87 |
last post by:
Hi everyone!
I'm writing some code in C under UNIX, which should give some output like this:
PARENT: pid = 10063
CHILD: my pid = 10064
CHILD: my parent's pid = 10063
CHILD: Sleeping...
PARENT:...
|
by: Buddha |
last post by:
Hello,
I posted this on two forums, without too much help .. and I am kinda
stuck in this.
I need to refresh the parent page from the second child window which
is opened by the first child and...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |