A bit of searching reveals that a few people have asked this question before, but I can never see the solution revealed.

I have a gridview and I've added a column with a template field so that I can put a checkbox control in it. Finding it is no problem, so I can determine if it's checked or unchecked. It's making it checked or unchecked using code that's got me scratching my head.

Here's the line that I've been trying to use in the vb file (which I know doesn't work). Perhaps it will show someone what I'm trying to do. Is there a simple solution here?
"Use" is the ID of my checkbox, but the intellisense shows me straight away that it doesn't understand "checked"; it doesn't know in this line that "Use" actually refers to a checkbox apparently. Any clues?

Gridview1.Rows(1).Cells(0).FindControl("Use").checked = True

Thanks very much in advance for any help.

6 Years
Discussion Span
Last Post by catherine sea

Excellent! Thank you, I found exactly what I needed there.
My code ended up as:

Dim Chb as Checkbox = CType(Arms.Rows(1).Cells(0).FindControl("Use"), CheckBox)
Chb.Checked = True
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.