GridView with checkboxes - how to use Dataset to update records based on checkbox selections

Lorna70
Lorna70 used Ask the Experts™
on
Hi I recently posted a question which I now need to extend to update the DB table.  Basically I have a GridView with records with checkbox next to each and the user selects multiple records by ticking the checkboxes and then clicking a button.  I have got as far as gathering the required values but now I need some way of setting the RouteID field for each record in the GridView with checkbox ticked all in one go.  I've looked at doing this in a SQL statement but finding that too complex, would like to do it using datasets (which I'm new to). I can probably get as far as populating the gridview from a dataset in the code behind but do I have to have a RouteID field in the gridview so that if a checkbox is ticked, the RouteID value is populated and then I update the DB or is there an easier way to do this?
Any ideas would be really appreciated.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Development Lead
Commented:
Hi,

on check box selection, you can put the row identity and other IDs (RouteID) in hidden field using JS, and then on update button event, you can got those values as

Dim selectedGroups As String = hdnFldSelectedGroups.Value.Remove(hdnFldSelectedGroups.Value.LastIndexOf(","))

then you can execute update queries as per records in hidden field.

So here you have to play with putting values in hidden field quit intelligently.

Cheers

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial