By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,089 Members | 1,199 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,089 IT Pros & Developers. It's quick & easy.

Datagrids and controls in cells

P: n/a
try this

Dim mycheck As CheckBox = CType(dgWelcomePacks.Items
(i).Cells(7).Controls(1), CheckBox)


-----Original Message-----

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,



Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.