|
sfDataGrid1.CurrentCellBeginEdit += SfDataGrid1_CurrentCellBeginEdit;
private void SfDataGrid1_CurrentCellBeginEdit(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellBeginEditEventArgs e)
{
//get the DataRow value
var dataRow = (e.DataRow.RowData as DataRowView).Row;
//get the currentcell value
var cellValue = dataRow[e.DataColumn.GridColumn.MappingName].ToString();
//Here customized the cell value based cancel the Editing
if (string.IsNullOrEmpty(cellValue))
{
e.Cancel = true;
}
} |
|
Queries |
Solutions |
|
Which means it can't set each cell with different back color either, can it? |
you can apply the background color for cell based on cell value can be achieve by using SfDataGrid.QueryCellStyle event. . For more information, please refer the below UG link, UG Link: https://help.syncfusion.com/windowsforms/datagrid/conditionalstyling https://help.syncfusion.com/windowsforms/datagrid/styling#styling-record-cell |
|
I'm sorry to ask this, is it possible to get the sum of a column into a GroupCaptionTextFormat?
|
We are little unclear with your scenario. Can you please provide the more information related to your query? Can you please share us below things? 1. Provide more details about your scenario with illustrations? 2. Provide more details about your scenario with image illustrations? It will be helpful for us to check on it and provide you the solution at the earliest.
|
|
Also, how can one change the format of a Column which is a string to double and vice versa?,
|
We are little unclear with your scenario. Can you please provide the more information related to your query?
Can you please share us below things? 1. Provide more details about your scenario with illustrations? 2. Provide more details about your scenario with image illustrations? It will be helpful for us to check on it and provide you the solution at the earliest.
|
|
numberFormat = new NumberFormatInfo();
//Set the decimal digit
numberFormat.NumberDecimalDigits = 3;
//trigger the AutoGenenerate column event
sfDataGrid1.AutoGeneratingColumn += SfDataGrid1_AutoGeneratingColumn;
private void SfDataGrid1_AutoGeneratingColumn(object sender, Syncfusion.WinForms.DataGrid.Events.AutoGeneratingColumnArgs e)
{
//check the Column
if (e.Column.MappingName == "OrderID")
{
e.Column.HeaderText = "Available Qty";
//Set the NumberFormatInfo
(e.Column as GridNumericColumn).NumberFormatInfo = numberFormat;
}
} |
|
sfDataGrid1.DrawCell += SfDataGrid1_DrawCell;
private void SfDataGrid1_DrawCell(object sender, Syncfusion.WinForms.DataGrid.Events.DrawCellEventArgs e)
{
//check the Column
if (e.Column.MappingName == "OrderID")
{
//displaye the number customized
e.DisplayText = (Math.Abs(Convert.ToDouble(e.DisplayText))).ToString();
}
} |
if(!string.IsNullOrEmpty( e.DisplayText))
possibly because there were some cells that were empty