DataGridBoolColumn is not displaying the proper values

  • Thread starter Edward Koucherian
  • Start date
E

Edward Koucherian

I'm getting the incorrect display value on my DataGrid column.

The field is numeric (1) in the SQL database table
The Code is
txtCol = New DataGridBoolColumn
txtCol.MappingName = "MyCol"
txtCol.HeaderText = ""
txtCol.Width = 25
txtCol.ReadOnly = False
txtCol.AllowNull = False
txtCol.TrueValue = 1
txtCol.FalseValue = 0
dgStyle.GridColumnStyles.Add(txtCol)

DataGrid1.TableStyles.Add(dgStyle)
DataGrid1.DataSource = typeDS.Tables("Details")

It's displaying the Null values state and the values for that
DataGrd1(rowNum, colNum) is Null in the DataGridBoolColumn paint event.
The real value of the field in the table is 1 or 0. When I'm changing the
column type to DataGridTextBoxColumn it's displaying the proper value.

Can anyone help me on this problem?

Thanks in Advance
Ed
 
K

Ken Tucker [MVP]

Hi,

Maybe this will work

txtCol.TrueValue = "1"
txtCol.FalseValue = "0"


Ken
---------------------
I'm getting the incorrect display value on my DataGrid column.

The field is numeric (1) in the SQL database table
The Code is
txtCol = New DataGridBoolColumn
txtCol.MappingName = "MyCol"
txtCol.HeaderText = ""
txtCol.Width = 25
txtCol.ReadOnly = False
txtCol.AllowNull = False
txtCol.TrueValue = 1
txtCol.FalseValue = 0
dgStyle.GridColumnStyles.Add(txtCol)

DataGrid1.TableStyles.Add(dgStyle)
DataGrid1.DataSource = typeDS.Tables("Details")

It's displaying the Null values state and the values for that
DataGrd1(rowNum, colNum) is Null in the DataGridBoolColumn paint event.
The real value of the field in the table is 1 or 0. When I'm changing the
column type to DataGridTextBoxColumn it's displaying the proper value.

Can anyone help me on this problem?

Thanks in Advance
Ed
 

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