checkboxes

  • Thread starter Thread starter suzy
  • Start date Start date
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
 
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.
 
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.
 
Back
Top