datagrid loop through to find checkbox

M

Mike

Sorry I'm a really newbie when it comes to C#.



My question is:

How do I loop through a datagrid control find all the checkboxes evaluate
wheather it's checked or not.

And also at the same time grab the label I've made for the product id.



A little more info:

I'm creating a shopping basket and when the user clicks on the selected
checkboxes from the datagrid and then click the "update" button, I would
like to find which checkbox was checked so I can remove it from the
datatable/session then rebind the datagrid.



Any help would be greatly appreciated.



Thanks
 
N

Nicholas Paldino [.NET/C# MVP]

Mike,

Assuming that the data grid is bound to a data table, why not just call
the SelectRows method on the DataTable class and get all the rows where the
column is represented by the checkbox is true?

You can then set the value appropriately, and take whatever action you
wish on that row.

Hope this helps.
 
M

Mike

Thanks i'll check this selectRows out...

Thanks for pointing me in the right direction :)



Nicholas Paldino said:
Mike,

Assuming that the data grid is bound to a data table, why not just call
the SelectRows method on the DataTable class and get all the rows where the
column is represented by the checkbox is true?

You can then set the value appropriately, and take whatever action you
wish on that row.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
Sorry I'm a really newbie when it comes to C#.



My question is:

How do I loop through a datagrid control find all the checkboxes evaluate
wheather it's checked or not.

And also at the same time grab the label I've made for the product id.



A little more info:

I'm creating a shopping basket and when the user clicks on the selected
checkboxes from the datagrid and then click the "update" button, I would
like to find which checkbox was checked so I can remove it from the
datatable/session then rebind the datagrid.



Any help would be greatly appreciated.



Thanks
 
M

Mike

Nicholas,
is there any chance of an example i've look in google and there's not too
many examples.

thanks in advance



Nicholas Paldino said:
Mike,

Assuming that the data grid is bound to a data table, why not just call
the SelectRows method on the DataTable class and get all the rows where the
column is represented by the checkbox is true?

You can then set the value appropriately, and take whatever action you
wish on that row.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Mike said:
Sorry I'm a really newbie when it comes to C#.



My question is:

How do I loop through a datagrid control find all the checkboxes evaluate
wheather it's checked or not.

And also at the same time grab the label I've made for the product id.



A little more info:

I'm creating a shopping basket and when the user clicks on the selected
checkboxes from the datagrid and then click the "update" button, I would
like to find which checkbox was checked so I can remove it from the
datatable/session then rebind the datagrid.



Any help would be greatly appreciated.



Thanks
 

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

Top