column-type numeric (vb)

Hello,

how to set a  type of a column and is it possible to set the type of a column to numeric, even though the column-type in database is non-numeric?

Best regards,
Frank

6 Replies

MS Maniratheenam Sehar Syncfusion Team November 11, 2014 04:25 AM UTC

Hi Frank,

 

Thanks for using Syncfusion Products.

 

Query:

Formatting Numeric Columns in a GridDataBoundGrid

You can just change the cell type for the columns in your databound grid.

For example.

this.gdbs.Binder.InternalColumns[1].StyleInfo.CellType = "Static";.

 

 For your specific cell type, you could use NumericUpDown, Currency, MaskedEdit, or even Static(if you format your value before you set it)

 

In addition to setting the CellType property,

 this.gdb.Binder.InternalColumns[1].StyleInfo.CellType,

you can also set the Format property and the CellValueTyle property.

 

 this.gdb.Binder.InternalColumns[1].StyleInfo.Format = "#.####"; //or "F4" or ???

this.gdb.Binder.InternalColumns[1].StyleInfo.CellValueType = typeof(double).

 

 

Please let us know, if you any concerns.

 

Regards,

ManiRatheenam S



FP Frank Piplak November 11, 2014 08:43 AM UTC

Hello,

works fine, many thanks.

But one Question, how I must set the 'CellType' to get a checkbox in the grid (database type is byte)?

Best regards,
Frank


FP Frank Piplak November 11, 2014 06:45 PM UTC

Hello,


I think that have a good solution:


With GridBound

  ' --- term to text ---

  .Binder.InternalColumns("steMyField01").StyleInfo.CellType = "Static"

  .Binder.InternalColumns("steMyField01").StyleInfo.CellValueType = GetType(System.String)

  ' --- byte to boolean

  .Binder.InternalColumns("steMyField02").StyleInfo.CellType = "CheckBox"

  .Binder.InternalColumns("steMyField02").StyleInfo.CellValueType = GetType(System.Boolean)

End With



My problem:

The value of the column 'steMyField02' in the database is 0 and 1 (Type Byte).


When I set:


  .Binder.InternalColumns("steMyField02").StyleInfo.CellType = "Static"

  .Binder.InternalColumns("steMyField02").StyleInfo.CellValueType = GetType(System.Boolean)

  

I get as result False and True in the grid but when I set: 


  .Binder.InternalColumns("steMyField02").StyleInfo.CellType = "CheckBox"

  .Binder.InternalColumns("steMyField02").StyleInfo.CellValueType = GetType(System.Boolean)

  

I get as result only unchecked fields!?


Have you the solution for right way?


Best regards,

Frank  The con



MK Muthukumar Kalyanasundaram Syncfusion Team November 14, 2014 02:28 PM UTC

Hi Frank,

 

Thanks for the update.

 

The reported scenario can be achieved by using “CheckBoxOptions” property. Please refer the code,

 

Code:

Me.gridDataBoundGrid1.Model.ColStyles(1).CellType = GridCellTypeName.[Static]

Me.gridDataBoundGrid1.Model.ColStyles(1).CellValueType = GetType(Boolean)

 

Me.gridDataBoundGrid1.Model.ColStyles(1).CheckBoxOptions = New GridCheckBoxCellInfo("1", "0", "", True)

Me.gridDataBoundGrid1.Model.ColStyles(1).CellType = GridCellTypeName.CheckBox

Me.gridDataBoundGrid1.Model.ColStyles(1).CellValueType = GetType(Boolean)

 

Please let us know if you have any concern.

 

Regards,

Muthukumar K


Attachment: GDBD__Check_79613ea1.zip


FP Frank Piplak November 15, 2014 05:01 PM UTC

Hi Muthukumar,

excellent, your example works not (at my project) but it shows me the solution.

At my project works this:

Me.gridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CheckBoxOptions = New GridCheckBoxCellInfo("1", "0", "", True)
Me.gridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CellType = "CheckBox"
Me.gridDataBoundGrid1.Binder.InternalColumns(1).StyleInfo.CellValueType = GetType(System.Boolean)

Many thanks!


MK Muthukumar Kalyanasundaram Syncfusion Team November 16, 2014 05:31 AM UTC

Hi Frank,

 

We are glad to hear that the reported issue has been resolved. Please let us know if you need any further assistance.

 

Regards,

Muthukumar K


Loader.
Up arrow icon