Re: ASP.NET Data Controls Hi,Oxygen
The GridView control is used to display a colletion of datas. The colletion can be a DataTable, DataSet and so on. If the gridview can be paged, it seems like it has one or more pages, displaying different datas from the colletion.
But, in fact, not all the datas is retrieved from the collection when the gridview is bound to it. Only those which will be displayed in current page like from the 5th row to the 10th in the table are retrieved. So you can only access those rows with the gridview.
To sovle your problem, you should loop through the datas in database, not the rows in GridView.
Take a datatable for example. You should add a new column to the datatable, which is a bool type to save the value of the checkbox, when you checked or unchecked the row in gridview, modify the values of the row in datable. The datatable should be save in Viewstate or session.
I hope it can help.
If you have any doubts about it, please feel free to post back.
__________________ Venkat knowledge is Power |