Hi,

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.

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

Glad to hear it helps. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.