checkboxes

S

suzy

hi,

i have created some checkboxes at runtime via a datalist control.

what code do i have to put on the server to determine which checkboxes have
been clicked?

any examples?

thanks
 
R

Rick Spiewak

Are you using Edit and Update? If so, you can tell during the Update command
processing. Use e.item.findcontrol to find the checkboxes, cast them to an
appropriate reference, and check the state.
 
J

John Bailo

It's not too different from dealing with a DataReader. You basically
iterate through the rows of the DataGrid ( using foreach ) and then select
the column and element inside the column, then cast it to the datatype that
you want to deal with.

Here's an article with some fairly explicit code examples:

http://www.c-sharpcorner.com/Code/2003/Jan/AccessDataGridVal.asp

I have just finished building a website in c# that does just this same
thing. It's tricky, but only in the sense of keeping track of where every
thing is. Remember, in each cell of the datagrid, you can treat all your
items as ASP Labels, TextBoxes, etc. That lets you iterate through the
collection at that level.
 

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,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top