Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox OnClick howto??

Status
Not open for further replies.

fostom

Programmer
Jul 3, 2002
31
NO
Hi!

I currently have a listbox which is generated from a DB. When I select an item in the listbox and then press a button it will generate an image from a DB. This works fine, but I want to get rid of the button and just have the listbox generate the image when I press the selected item in the listbox. Anyone know how this works?

I have tried to get the data with
1. lstmovies_Click()
2. lstmovies_SelectedIndexChanged

and call for the Sub in the asp:listbox OnClick="lstMovies_Click/lstMovies_SelectedIndexChanged

..but either way I get an error saying lstMovies_Click or lstMovies_SelectedIndexChanged is UNDEFINED..

I just want to drop the button and let the listbox take care of the action...

Regards,

Tommy
 
Try turning the AutoPostBack property of the listbox to true. Then your codo on both Click and SelectedIndexChanged
events will run.
NetAngel
 
Turning the autopostback to true have no effect.. atleast not with my code :(

Tommy
 
Hmmm...i know that at the end of every sub relating to a control, there's a statement that says
Handles lstMovies.SelectedItemIndex

it could be since your ddl is being created on teh fly that there isn't anything linking the sub to the control.

Does teh control need to be created dynamically at run time?

jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top