Hi Farooq,
Thanks for your interest in
Syncfusion products.
Query: The problem is it is showing the data type as
string even through the data in there is a number 8. |
The value’s will be returned
with string because if you bind values to the grid in the gridControl1.Text property. So please
bind the values of the gridcontrol1.CellValue
property to get the datatype. |
Please refer to the code
snippet.
Code snippet: this.gridControl1[1, 1].CellValue =
32; //integer type. //In a button click event... MessageBox.Show(gridControl1[1,
1].CellValue.GetType().ToString());//this will return System.Int32... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>. this.gridControl1[1, 1].Text = “32”; //string type. //In a button click event... MessageBox.Show(gridControl1[1,
1].CellValue.GetType().ToString());//this will return System.String... >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //If none of the datatype is provided
it will return as string. |
Please let me know if you
have any other concerns.
Regards,
Arun.
Hi Farooq,
Thanks for the update.
Query: Get the
celltype of the grid cell. |
The required behavior can be customized by using the following file,
please use the clipboardcanpaste event
and parsing the text will give the required actions. Way2: You can also make use of the following code. gridControl1[row,
col].CellValueType = typeof(int);
|
Please let me know if you have any other concerns.
Regards,
Arun.
Hi Farooq,
Please regret the inconvenience
caused.
Query: Get the celltype of
the grid cell after a clipboard copy paste. |
You can make use of the
following Model.ClipboardCanPaste event for achieving the reported behavior. Please
refer the following code snippet. Note: Default behavior of a grid
cell is whenever you paste data into the grid cell the type will be set to
string. |
Code: void Model_ClipboardCanPaste(object sender, GridCutPasteEventArgs
e) { e.Result.GetTypeCode(); MessageBox.Show(e.RangeList.ActiveRange.GetType().ToString()); MessageBox.Show(gridControl1[1,
1].CellValue.GetType().ToString()); }
|
Please let me know if you
have any other concerns.
Regards,
Arun.
Hi Farooq,
Thanks for the update.
Query: Get the celltype of
the grid cell after a clipboard copy paste. |
In
this case I had implemented the required behavior in gridControl1.CurrentCellActivated Event. Please make use the following code and revert us if
the issue still exits. Note: Again we remaind you about Default behavior of a grid cell
is whenever you paste data into the grid cell the type will be set to string.
|
Please refer to the code snippet.
Code: Private Sub
gridControl1_CurrentCellActivated(sender As Object, e As EventArgs) Dim
str As String = gridControl1.CurrentCell.Renderer.ControlText Dim
intValue As Int32 Dim
bigintValue As Int64 Dim
doubleValue As Double Dim
boolValue As Boolean Dim
dateValue As DateTime If
Int32.TryParse(str, intValue) Then MessageBox.Show("32
bit Integer value") ElseIf
Int64.TryParse(str, bigintValue) Then MessageBox.Show("64
bit Integer value") ElseIf
Double.TryParse(str, doubleValue) Then MessageBox.Show("Double
value") ElseIf
Boolean.TryParse(str, boolValue) Then MessageBox.Show("boolean
value") ElseIf
DateTime.TryParse(str, dateValue) Then MessageBox.Show("Datetime
value") Else MessageBox.Show("String") End
If End Sub //…………. Now based on clicking the current cell the current cell
value is reflected and its particular datatype is calculate. |
Please let me know if you have any other concerns.
Regards,
Arun.