|
-
May 8th, 2005, 01:29 PM
#1
Thread Starter
Member
OnSelectedIndexChanged Doesn't work *Resolved*
hi all;
I have place the following code in a OnSelectedIndexChanged sub..
Here is the code...
VB 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 ????
Thanks
Last edited by ahmedabugh; May 12th, 2005 at 12:45 AM.
-
May 8th, 2005, 07:20 PM
#2
Re: OnSelectedIndexChanged Doesn't work
What code do you have for the listbox in the HTML source?
-
May 9th, 2005, 10:39 PM
#3
Thread Starter
Member
Re: OnSelectedIndexChanged Doesn't work
Hi,
VB Code:
<asp:ListBox id="ListBox1" runat="server" Width="279px" OnSelectedIndexChanged="ListBox1_SelectedIndexChanged" Height="102px"></asp:ListBox>
-
May 10th, 2005, 04:37 AM
#4
Frenzied Member
Re: OnSelectedIndexChanged Doesn't work
You need to set the AutoPostBack property to true.
HTH
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
May 12th, 2005, 12:44 AM
#5
Thread Starter
Member
Re: OnSelectedIndexChanged Doesn't work
you r right, that was my mistake..
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|