By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

DataList with checkbox Postback Problem

P: n/a
Here's the scenario:

I have a DataList populated from a datatable sitting inside a
fieldset. Each element (row) in the Datalist has the following child
controls: asp:checkbox, asp:image, asp:labels.

Within the <form>, but outside the fieldset, containing the datatlist,
I have a usercontrol (used to collect search criteria) and some
asp:button controls (used to initiate actions - ie. retrieve db data,
reset user control fields, download data from the datalist).

The design is intended to allow the user to specify some criteria,
retrieve data and populate the datalist. Once the datalist is
populated, the user is allowed to selected 0, 1, or many checkboxes in
the datalist rows.

By clicking the "download" asp:button I wanted to be able to parse the
datalist for checked rows and download the data.


Obviously, when the user clicks the asp:button to download the page is
postedback and, though DataList.Enableviewstate=true the datalist data
is lost by the time the asp:button clicked event is handled. The
UserControl (criteria) is persisted in viewstate and is re-loaded on
page_load (no problem there).

I've tried wiring-up, and using, Javascript with the "Onclick" event
of the download asp:button. The Javascript function does fire but the
datalist, and its contents, are no where to be found when I parse the


I assume that this is something fairly straight-forward to accomplish
but it eludes me. I need to know how to retrieve/persist the datalist
data (including the checkbox states.

Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
By way of follow-up...

Apparently my Javascript, to parse the page, could not "see" into the
Fieldset that I was using to contain the asp:Datalist control. Once I
replaced the Fieldset with a <DIV style=...> tag the Javascript worked
just fine!

Now, I guess, I'll parse the Datalist checkboxes with Javascript and
populate a hidden field on the page to capture/persist the selected
Datalist rows.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.