Check Box in the Datagrid

G

Guest

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.
 
G

Guest

I'm using GUI to build the form.
It built the code:

'DtGrdTblStlVolcanos
'
Me.DtGrdTblStlVolcanos.DataGrid = Me.grdVolcanos
Me.DtGrdTblStlVolcanos.GridColumnStyles.AddRange(New
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("DtGrdColWebMetVolcanoStatus.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.
 
C

Cor Ligthert

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
 

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

Top