Groups | Blog | Home
all groups > asp.net > may 2004 >

asp.net : checkboxes


suzy
5/6/2004 11:12:02 PM
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

Rick Spiewak
5/7/2004 1:13:48 AM
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.

[quoted text, click to view]

John Bailo
5/7/2004 5:22:40 AM

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.



[quoted text, click to view]



--
AddThis Social Bookmark Button