reference a checkboxfield from the code-behind

G

graphicsxp

Hi,
I have a checkboxfield in my gridview:

<asp:CheckBoxField DataField="Analysed" HeaderText ="Analysed">
<ItemStyle width="20px" />
</asp:CheckBoxField>

How can I reference the field from my code-behind ? I can't see any
properties/methods on the grid to access it.
There's no ID so I can't do FindControl :(

Can you help ?

Thanks
 
R

Ray Booysen

graphicsxp said:
Hi,
I have a checkboxfield in my gridview:

<asp:CheckBoxField DataField="Analysed" HeaderText ="Analysed">
<ItemStyle width="20px" />
</asp:CheckBoxField>

How can I reference the field from my code-behind ? I can't see any
properties/methods on the grid to access it.
There's no ID so I can't do FindControl :(

Can you help ?

Thanks
You can access it via the Datagrid row...

For a specified row:

CheckBox MyCheckBox =
(CheckBox)MyGrid.Rows[MyRowIndex].columns[MyCheckboxColumnIndex].Controls[0];

obviously substituting the index variables with the appropriate indexes
that you have.

Regards
Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top