473,498 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reference a checkboxfield from the code-behind

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

Jul 14 '06 #1
1 2555
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
Jul 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

110
9809
by: Mr A | last post by:
Hi! I've been thinking about passing parameteras using references instead of pointers in order to emphasize that the parameter must be an object. Exemple: void func(Objec& object); //object...
3
10327
by: Brad | last post by:
I am programatically trying to add a checkBox column to a gridView. This is what I have to do it (VB): Dim cbCol As New CheckBoxField cbCol.Text = "Enter this event" gvEvents.Columns.Add(cbCol)...
3
1245
by: mike.aes | last post by:
(ASP.net 2.0) I am using a Gridview control that is bound to a table in my SQL database. For some reason, when the Checkbox is clicked, it stores a 1 (Positive 1) in the bound field instead of a...
2
7208
by: hazz | last post by:
Given the update query UPDATE Columns SET Include_in_Report = @Include_in_Report WHERE (ID = @Original_ID); Include_In_Report is a bit field in the table, represented as a...
27
4184
by: David W | last post by:
I'm almost tearing my hair out. A colleague claimed that a null reference can exist, like this: void f( int& p ) { printf( "%d\n", p ); } int main (int argc, char *argv) {
1
4733
by: spitapps | last post by:
I have a gridview declaratively added to my webform. This gridview displays data from a stored procedure returned as a dataset. Once the dataset has been modified slightly i bind it to my...
0
1654
by: Gustavo Ringel | last post by:
Hi, I'm trying to get the checked/unchecked of a Gridview CheckBoxField in code. I tried to cast the row cell to a CheckBoxField and it doesn't compiles. I'm also able to get the Text of the...
0
2393
by: Jason Huang | last post by:
Hi, How do I bind data to a GridView in my C#.Net 2.0? Given that in the GridView1 I have 3 BoundFields and 1 CheckBoxField. I can bind the DataSet to the 3 BoundFields if there's no...
275
12025
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
1617
by: Slickuser | last post by:
I want to implement a GridView that displays all records in the database & which contain CheckBoxField (true,false). Whenever this form is displayed, the user can be able to change the status of...
0
7005
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6891
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5465
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4916
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4595
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1424
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
293
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.