473,396 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Check Box in the Datagrid

I need to add editable check box column to the data grid. I have field in the
SQL table with the type tinyint, which is translated to the unsigned bite in
the datatable.
I added DataGridBoolColumn to the table style with AllowNull = False,
TrueValue = 1 and FalseValue = 0. Everything looks fine but when I run the
form all checkboxes appear checked and not connected to underlying field. Any
suggestions?
Thanks Bronislav.
Nov 21 '05 #1
3 1130
Bronislav,

Here a very simple sample about the use of styles with the textbox and
boolcolumn

http://www.windowsformsdatagridhelp....6-3300b2215049

I hope this helps,

Cor
Nov 21 '05 #2
I'm using GUI to build the form.
It built the code:

'DtGrdTblStlVolcanos
'
Me.DtGrdTblStlVolcanos.DataGrid = Me.grdVolcanos
Me.DtGrdTblStlVolcanos.GridColumnStyles.AddRange(N ew
System.Windows.Forms.DataGridColumnStyle() {Me.DtGrdColVolcanoName,
Me.DtGrdColVolcanoLocation, Me.DtGrdColVolcanoLongitude,
Me.DtGrdColVolcanoLatitude, Me.DtGrdColWebMetVolcanoStatus})
Me.DtGrdTblStlVolcanos.HeaderFont = New
System.Drawing.Font("Microsoft Sans Serif", 8.25!,
CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Underline),
System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DtGrdTblStlVolcanos.HeaderForeColor =
System.Drawing.SystemColors.Desktop
Me.DtGrdTblStlVolcanos.MappingName = "WebMetVolcano"

'DtGrdColWebMetVolcanoStatus
'
Me.DtGrdColWebMetVolcanoStatus.AllowNull = False
Me.DtGrdColWebMetVolcanoStatus.FalseValue = 0
Me.DtGrdColWebMetVolcanoStatus.HeaderText = "Active"
Me.DtGrdColWebMetVolcanoStatus.MappingName = "WebMetVolcanoStatus"
Me.DtGrdColWebMetVolcanoStatus.NullValue =
CType(resources.GetObject("DtGrdColWebMetVolcanoSt atus.NullValue"), Object)
Me.DtGrdColWebMetVolcanoStatus.TrueValue = 1
Me.DtGrdColWebMetVolcanoStatus.Width = 75

It looks OK for me but doesn't work. If I change the column style of the
column to standart text box it will show proper value from the data table.
Thanks Bronislav.

"Cor Ligthert" wrote:
Bronislav,

Here a very simple sample about the use of styles with the textbox and
boolcolumn

http://www.windowsformsdatagridhelp....6-3300b2215049

I hope this helps,

Cor

Nov 21 '05 #3
Bronislav,

The styles are for a windowform datagrid. I get the idea that you want to
use it for a webform datagrid. That are almost completly different controls,
with the exception that they should do the same.

Cor
Nov 21 '05 #4

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

Similar topics

4
by: VR | last post by:
I am trying to embed a check box into a FlexGrid's cell, but having a problem when I start scrolling the grid. Here is my MyCheckBox class... class MyCheckBox : CheckBox { void Init (...
1
by: Neal | last post by:
HI all, I have an issue with check box in datagrid. I would like it to check and uncheck based on a database value of NULL or a Date Value. If there is a date value for that column then check...
7
by: Jaime Stuardo | last post by:
Hi all.. I have a DataGrid with checkboxes. In the header I have a "check all" checkbox. I'm wondering if there is an easy way to check all checkboxes using that checkbox. I could do it using...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
1
by: .NETn00b | last post by:
Is this possible? I need to create a multi-select DataGrid, and I cannot use CheckBoxes. I want the selected rows to appear highlighted. One possible work-around that occurred to me was to...
2
by: Chris Davoli | last post by:
How do you enable a check box in the GridView. I selected Checkbox Field in the Columns of the GridView, and the check box shows up in the Grid view, but it is disabled. How do I enable it so I can...
14
by: Brett Romero | last post by:
I'm using a DataGrid and have assigned this.DataSourceChanged += new EventHandler( DataGrid_DataSourceChanged ); This works fine but there is one case where it doesn't. How can I check if...
10
by: rn5a | last post by:
All the rows in a DataGrid, including the Header, are accompanied with a CheckBox. I want that when the CheckBox in the Header is checked, then all the CheckBoxes should automatically get checked....
0
by: Scott | last post by:
Hello all and thanks in advance for any help you may be able to offer me. I am quite new to asp.net and am trying to work with a datagrid but am having some problems with it. Here's the...
0
by: sumitdipsite2005 | last post by:
I am trying to use VB6 as a middleware between two 3rd party applications. "App. A" ----> VB6 ------> "App B" i am having no trouble sending data from VB to the "App B". But i am having...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.