I've tried the suggested solution but I'm still getting
the same error. It seems that once the page postback is
envoked the checkbox control is removed from the datagrid
so all my changes (ticks etc) are lost. Is there a way of
retaining the checkbox control on a postback?
Thanks,
Jo
***********************
try this
Dim mycheck As CheckBox = CType(dgWelcomePacks.Items
(i).Cells(7).Controls(1), CheckBox)
regards,
Kumar.
-----Original Message-----
Hi,
I'm doing a web application and I have a datagrid that's
linked to a dataset. For one of the columns in the
datagrid I create and add a checkbox control so that userscan easily modify the value in the dataset. I do that in
the following way:
Dim mycheck As New CheckBox()
dgWelcomePacks.Items(i).Cells(7).Controls.Add(myc heck)
I then mark the checkbox as ticked or unticked, depending
on the dataset value in the cell.
That all works fine.
Now when a user has finished with all the data in the
datagrid (ie ticking\unticking the checkboxes on differentrows) I want to be able to update the dataset with the newcheck values. I tried by running through all the rows in
the datagrid and piking up the checkbox control value:
Dim mycheck As CheckBox = CType(dgWelcomePacks.Items
(i).Cells(7).Controls(0), CheckBox)
But that gives me an error saying that there is no controlin that cell (index out of range). How can that be when I
see the checkbox in the cell on the screen? Is there
something that I'm not doing when I'm initially creating
the checkbox and adding it as a control to the cell?
Any help would be greately appreciated.
Thanks in advance,
Jo
.