hi all;
I have place the following code in a OnSelectedIndexChanged sub..
Here is the code...
Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
LISTBOX2.ITEMS.CLEAR
dim selectstring as string
Dim cn1 As OleDbConnection = New OleDbConnection(ConfigurationSettings.appSettings("connectionstring"))
cn1.Open()
selectString = "select question_id, Question from questions where exam_id = " & listbox1.selecteditem.value
Dim cmd1 As OleDbCommand = New OleDbCommand(selectString, cn1)
Dim reader1 As OleDbDataReader = cmd1.ExecuteReader()
dim liadd as listitem
while(reader1.read())
liadd = new listitem
liadd.text = reader1("question").tostring
liadd.value = reader1("question_id").tostring
listbox2.items.add(liadd)
end while
End Sub
But it doesn't work. As you can see it must refresh the values of a list box, but simply nothing happens...
Is there a mistake somewher ??
ThanksWhat code do you have for the listbox in the HTML source?
Hi,
<asp:ListBox id="ListBox1" runat="server" Width="279px" OnSelectedIndexChanged="ListBox1_SelectedIndexChanged" Height="102px"></asp:ListBox>
You need to set the AutoPostBack property to true.
HTH
DJ
you r right, that was my mistake..
Thanks
Thursday, March 29, 2012
OnSelectedIndexChanged Doesnt work *Resolved*
Labels:
alli,
asp,
code,
following,
listbox1_selectedindexchanged,
net,
object,
onselectedindexchanged,
resolved,
sub
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment