graphicsxp
2006-07-14 08:27:15 PM

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

 

Re: reference a checkboxfield from the code-behind

Ray Booysen
2006-07-14 09:06:00 PM

graphicsxp wrote:
>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