Dropdown boxes in my datalist control

J

Jason James

Hi,

I have a datalist that contains a series of thumbnails. I am
in the process of paging this datalist so that only 20 images
are displayed at a time. Each image has associated with
it a pair of dropdown boxes. The user selects theor choices
from the dropdown boxes and then moves to the next
series of 20 images. The postbackURL of the button
click contains the information regarding the next page to
display.

Now, I want to be able to capture the users selections
from the dropdown boxes associated with each thumbnail
before the next page of thumbnails is bound to the datalist
and then bind the next set of records from the datasource
to the datalist.

Does anyone have any ideas which event I should write
my code in to determine which dropdown boxes have had
their values changed before the databinding of the next
images occurs?

Many thanks,

Jason.
 
S

S. Justin Gengo

Jason,

There are two ways you could do this. You could write a "CheckDropdowns"
routine that is called from pageload (first check that the datalist already
exists and is populated). In the CheckDropdowns subroutine you would loop
through each datalist item, get the dropdown out of the item and check it's
value.

Another way would be to create an selecteditemchanged event handler for the
dropdown itself (I'm assuming you added the drop downs dynamically). If you
didn't add the dropdowns dynamically they should already have their own
selecteditemchanged event already hooked up. Once you hook up this event to
the dropdowns they will fire the event on their own. This would be the
preferred method because the event will only fire for a drop down that has
been changed. The following article does this but uses a datagrid; it should
be easily convertible for your uses:
http://www.odetocode.com/Articles/231.aspx


Regards,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
J

Jason James

Justin,

I am scrolling up and down a (longish) datalist and didn't want the
autopostback of the dropdownlist controls to take me to the top of the
datalist each time, plus the postback can be annoying. I would like to
process all of the dropdownlist controls in one go just prior to the
next page of records being loaded.

Any other thoughts?

Jason.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top