CustomCellTypes.CalculatorTextBox and CustomCellTypes.ButtonEdit.ToString();

Hi
1. how to display new CalculatorControl () in gridGroupingControl1.TableDescriptor.Columns["quantity"].
2. how to display  in      gridGroupingControl1.TableDescriptor.Columns["item"].Appearance.AnyRecordFieldCell.CellType just like in textBox1
please help

Regards
Gregory


Attachment: test002_6772851c.rar

45 Replies

MG Mohanraj Gunasekaran Syncfusion Team August 2, 2018 06:23 AM UTC

Hi Gregory, 
 
Thanks for using Syncfusion product. 
 
Query 
Solution 
how to display new CalculatorControl () in gridGroupingControl1.TableDescriptor.Columns["quantity"]. 
 
To use the CustomCellType for GridGroupingControl, you could register that celltype using RegisterCellModel.GridGroupingCellType method. Please refer to the below code example and the sample, 
 
Code example 
RegisterCellModel.GridGroupingCellType(this.gridGroupingControl1, CustomCellTypes.CalculatorTextBox); 
gridGroupingControl1.TableDescriptor.Columns["quantity"].Appearance.AnyRecordFieldCell.CellType = CustomCellTypes.CalculatorTextBox.ToString(); 
 
If you want to add the custom control for grid cell’s, please refer to the below KB link, 
 
how to display in gridGroupingControl1.TableDescriptor.Columns["item"]. Appearance.AnyRecordFieldCell.CellType just like in textBox1  
 
Suggestion1 
To make the changes in button appearance, you could use the ButtonEditStyleProperties.ButtonEditInfo properties please refer to the below code example, 
 
Code example 
ButtonEditStyleProperties buttonStyle = new ButtonEditStyleProperties(this.gridGroupingControl1.TableDescriptor.Columns["item"].Appearance.AnyRecordFieldCell); 
buttonStyle.ButtonEditInfo.ButtonEditType = ButtonType.Image; 
buttonStyle.ButtonEditInfo.Image = SystemIcons.Application.ToBitmap(); 
 
Please refer to the below UG link to know about the type of ButtonEdit, 
 
Suggestion2 
Also, you can customize the button appearance using GridDrawButtonFace event. Please refer to the below code example, 
 
Code example 
var buttonEditModel = this.gridGroupingControl1.TableModel.CellModels["ButtonEdit"] as ButtonEditCellModel; 
if(buttonEditModel != null) 
    buttonEditModel.GridDrawButtonFace += ButtonEditModel_GridDrawButtonFace; 
 
private void ButtonEditModel_GridDrawButtonFace(object sender, GridDrawButtonFaceEventArgs e) 
{ 
    e.Graphics.FillRectangle(new SolidBrush(Color.Gray), e.Button.Bounds); 
    Rectangle rect = e.Button.Bounds; 
    rect.Inflate(-4, -4); 
    e.Graphics.FillRectangle(new SolidBrush(Color.White), rect); 
    e.Handled = true; 
} 
 
 
 
Sample link: GridGroupingControl 
 
Regards, 
Mohanraj G 



GP Gregory Pe replied to Mohanraj Gunasekaran August 2, 2018 08:06 AM UTC

Hi Gregory, 
 
Thanks for using Syncfusion product. 
 
Query 
Solution 
how to display new CalculatorControl () in gridGroupingControl1.TableDescriptor.Columns["quantity"]. 
 
To use the CustomCellType for GridGroupingControl, you could register that celltype using RegisterCellModel.GridGroupingCellType method. Please refer to the below code example and the sample, 
 
Code example 
RegisterCellModel.GridGroupingCellType(this.gridGroupingControl1, CustomCellTypes.CalculatorTextBox); 
gridGroupingControl1.TableDescriptor.Columns["quantity"].Appearance.AnyRecordFieldCell.CellType = CustomCellTypes.CalculatorTextBox.ToString(); 
 
If you want to add the custom control for grid cell’s, please refer to the below KB link, 
 
how to display in gridGroupingControl1.TableDescriptor.Columns["item"]. Appearance.AnyRecordFieldCell.CellType just like in textBox1  
 
Suggestion1 
To make the changes in button appearance, you could use the ButtonEditStyleProperties.ButtonEditInfo properties please refer to the below code example, 
 
Code example 
ButtonEditStyleProperties buttonStyle = new ButtonEditStyleProperties(this.gridGroupingControl1.TableDescriptor.Columns["item"].Appearance.AnyRecordFieldCell); 
buttonStyle.ButtonEditInfo.ButtonEditType = ButtonType.Image; 
buttonStyle.ButtonEditInfo.Image = SystemIcons.Application.ToBitmap(); 
 
Please refer to the below UG link to know about the type of ButtonEdit, 
 
Suggestion2 
Also, you can customize the button appearance using GridDrawButtonFace event. Please refer to the below code example, 
 
Code example 
var buttonEditModel = this.gridGroupingControl1.TableModel.CellModels["ButtonEdit"] as ButtonEditCellModel; 
if(buttonEditModel != null) 
    buttonEditModel.GridDrawButtonFace += ButtonEditModel_GridDrawButtonFace; 
 
private void ButtonEditModel_GridDrawButtonFace(object sender, GridDrawButtonFaceEventArgs e) 
{ 
    e.Graphics.FillRectangle(new SolidBrush(Color.Gray), e.Button.Bounds); 
    Rectangle rect = e.Button.Bounds; 
    rect.Inflate(-4, -4); 
    e.Graphics.FillRectangle(new SolidBrush(Color.White), rect); 
    e.Handled = true; 
} 
 
 
 
Sample link: GridGroupingControl 
 
Regards, 
Mohanraj G 


Hi Mohanraj

Thank you for your answer

ad 1
how to display new CalculatorControl () in gridGroupingControl1.TableDescriptor.Columns["quantity"]. 

it's better but how to cause it
the calculated number on the calculator inserted the result in the field of the

Regards
Gregory



MG Mohanraj Gunasekaran Syncfusion Team August 3, 2018 10:22 AM UTC

Hi Gregory, 
 
Thanks for your update. 
 
By default, CalculatorTextBox control type column does only allow the string data type. So, please make your quantity column type as string. Please refer to the below code example, 

Code example 
//Creates quantity column. 
myDataColumn = new DataColumn(); 
myDataColumn.DataType = Type.GetType("System.String"); 
myDataColumn.ColumnName = "quantity"; 
myDataTable.Columns.Add(myDataColumn); 

By default, the calculated result will be inserted into the field. To get the calculated result, you could use the ValueCalculated event. Please refer to the below code example, 
 
Code example 
c20.ValueCalculated += C20_ValueCalculated; 
 
private void C20_ValueCalculated(object sender, CalculatorValueCalculatedEventArgs arg) 
{ 
    if (arg.LastAction == CalcActions.CalcOperatorEquals) 
    { 
        var value = arg.Value; 
    } 
} 
 
Sample link: GridGroupingControl 
 
Please let us know if we misunderstood your query. 
 
Regards, 
Mohanraj G 



GP Gregory Pe August 3, 2018 12:53 PM UTC

Hi Mohanraj

Thank you for your answer  

please make your quantity column type as string

        //    myDataColumn.DataType = Type.GetType("System.String"); 
            myDataColumn.DataType = Type.GetType("System.Decimal");

I have modified  it's good - works with Type.GetType("System.Decimal");

 private void C20_ValueCalculated(object sender, CalculatorValueCalculatedEventArgs arg)
        {// //using System.Globalization;
          
            if (arg.LastAction == CalcActions.CalcOperatorEquals)
            {
              
                var value = arg.Value;
                decimal d = 0;
                var clone = (CultureInfo)CultureInfo.InvariantCulture.Clone();
                clone.NumberFormat.NumberDecimalSeparator = ".";
                clone.NumberFormat.NumberGroupSeparator = ",";
                string s = value.ToString(); // "1,891453";
                d = decimal.Parse(s, clone);

                this.gridGroupingControl1.Table.CurrentRecord.SetValue("quantity",  Math.Round(d, 4));

                //         this.gridGroupingControl1.Table.CurrentRecord.SetValue("quantity", value.ToString());

            }
        }




Regards
Gregory


MG Mohanraj Gunasekaran Syncfusion Team August 6, 2018 04:41 AM UTC

Hi Gregory, 
 
Thanks for your update. 
 
Yes, you were right. If you want to update the cell value with formatted text, you can use the Record.SetValue method in CalculatorControl.ValueCalculated event to update the cell value  as per your update. Anyway, we are glad to know that your reported problem has resolved. 
 
Please let us know if you have any concerns. 
 
Regards, 
Mohanraj G 



GP Gregory Pe replied to Mohanraj Gunasekaran August 6, 2018 06:02 PM UTC

Hi Gregory, 
 
Thanks for your update. 
 
By default, CalculatorTextBox control type column does only allow the string data type. So, please make your quantity column type as string. Please refer to the below code example, 

Code example 
//Creates quantity column. 
myDataColumn = new DataColumn(); 
myDataColumn.DataType = Type.GetType("System.String"); 
myDataColumn.ColumnName = "quantity"; 
myDataTable.Columns.Add(myDataColumn); 

By default, the calculated result will be inserted into the field. To get the calculated result, you could use the ValueCalculated event. Please refer to the below code example, 
 
Code example 
c20.ValueCalculated += C20_ValueCalculated; 
 
private void C20_ValueCalculated(object sender, CalculatorValueCalculatedEventArgs arg) 
{ 
    if (arg.LastAction == CalcActions.CalcOperatorEquals) 
    { 
        var value = arg.Value; 
    } 
} 
 
Sample link: GridGroupingControl 
 
Please let us know if we misunderstood your query. 
 
Regards, 
Mohanraj G 


Hi Mohanraj


1. how to enter a large number in colunaNum ColumnName = "quantity"; it must be Type.GetType ("System.Decimal");
to work
gridGroupingControl1.TableDescriptor.Columns ["quantity"]. Appearance.AnyRecordFieldCell.CellType = CustomCellTypes.CalculatorTextBox.ToString ();


2 how to add a button on the left
//ButtonAlignment.Left;
 
down
Columns [ "item_ValueMember"]
for AutoSuggest to work

gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember"]. Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl; // ComboBox;
            
gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember"]. Appearance.AnyRecordFieldCell.AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest; // AutoComplete;
            
gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember"]. Appearance.AnyRecordFieldCell.DataSource = myDataTable2;
            
gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember"]. Appearance.AnyRecordFieldCell.DisplayMember = "item2";
            
gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember"]. Appearance.AnyRecordFieldCell.ValueMember = "id2";
            
gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember"]. Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Show;

I tried through
  
this.gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember_Editor_Cell"]. Appearance.AnyRecordFieldCell.CellType = "ComboBoxButtonEditCell";

but it is not correct

I tried with:
 
 
gridGroupingControl1.TableDescriptor.Columns ["Button_Multi"]. Appearance.AnyRecordFieldCell.CellType = "MultipleButton";
and
ridGroupingControl1.TableDescriptor.Columns ["ImmageMulti"]. Appearance.AnyRecordFieldCell.CellType = "MultipleImage";

it has no good effect

please help

Regards
Gregory

Attachment: test002_192612e9.rar


MG Mohanraj Gunasekaran Syncfusion Team August 7, 2018 12:00 PM UTC

Hi Gregory, 
 
Thanks for your update. 
 
Query 
Solution 
how to enter a large number in colunaNum ColumnName = "quantity"; it must be Type.GetType ("System.Decimal");
to work
 
By default, CalculatorTextBox control type column does not have the support for decimal type. But, you can achieve your scenario by implementing the custom cell renderer for CalculatorTextBox which inherits from GridStaticCellRenderer. Please refer to the below code example, 
 
Code example 
this.gridGroupingControl1.TableControl.CellRenderers["CalculatorTextBox"] = new CustomCalculateTextboxRenderer(this.gridGroupingControl1.TableControl, new DropDownCalculatorTextBoxCellModel(this.gridGroupingControl1.TableModel)); 
 
public class CustomCalculateTextboxRenderer : GridStaticCellRenderer 
{ 
 
    void calci_ValueCalculated(object sender, CalculatorValueCalculatedEventArgs arg) 
    { 
        GridCurrentCell cc = this.Grid.CurrentCell; 
        GridStyleInfo style = this.Grid.Model[cc.RowIndex, cc.ColIndex]; 
        if (style.CellValueType == typeof(Decimal)) 
            style.CellValue = this.calci.Value.ToDecimal(); 
        else if (style.CellValueType == typeof(Double)) 
            style.CellValue = this.calci.Value.ToDouble(); 
        else if (style.CellValueType == typeof(int)) 
            style.CellValue = Convert.ToInt16(this.calci.Value); 
        else 
            style.CellValue = this.calci.Value.ToString(); 
    } 
 
    public override void DropDownContainerShowingDropDown(object sender, System.ComponentModel.CancelEventArgs e) 
    { 
        GridStyleInfo style = this.Grid.Model[RowIndex, ColIndex]; 
        this.calci = style.Control as CalculatorControl; 
        this.calci.ShowDisplayArea = false; 
        this.calci.Size = new Size(260, 180); 
 
        if (this.DropDownContainer != null) 
        { 
            this.DropDownContainer.Controls.Add(this.calci); 
        } 
 
        this.DropDownContainer.Size = this.calci.Size; 
        this.calci.ValueCalculated += new CalculatorValueCalculatedEventHandler(this.calci_ValueCalculated); 
    } 
} 
 
//ButtonAlignment.Left;
 down
Columns [ "item_ValueMember"]
for AutoSuggest to work
 
To use the AutoSuggest option, you could use the DropDownStyle property. Please refer to the below code example, 
 
Code example 
gridGroupingControl1.TableDescriptor.Columns["item_ValueMember"].Appearance.AnyRecordFieldCell.DropDownStyle = GridDropDownStyle.AutoComplete; 
I tried through
  this.gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember_Editor_Cell"]. Appearance.AnyRecordFieldCell.CellType = "ComboBoxButtonEditCell";

but it is not correct

I tried with:
 
 gridGroupingControl1.TableDescriptor.Columns ["Button_Multi"]. Appearance.AnyRecordFieldCell.CellType = "MultipleButton";
and
ridGroupingControl1.TableDescriptor.Columns ["ImmageMulti"]. Appearance.AnyRecordFieldCell.CellType = "MultipleImage";
 
We have analyzed your custom cell model and renderers (ComboBoxButtonEditCell, MultipleButton and MultipleImage). We are little bit unclear about your scenario. Please let us know what kind of issue are you facing when use this custom cell models and custom cell renderers. It will be helpful to proceed further.  
 
In below attached sample, we have implemented the code to align the button as left by overriding the OnLayout method in your custom cell renderer(ComboCellRenderer). Please refer to the below code example, 
 
Code example 
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
{ 
    Rectangle cellRectangle = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
    int buttonWidth = rect.Width; 
    for (int i = 0; i < buttonsBounds.Length; i++) 
    { 
        if (i == 0) 
        { 
            buttonsBounds[i].X = cellRectangle.X; 
        } 
        else 
            buttonsBounds[i].X = buttonsBounds[i - 1].Right; 
    } 
    If(buttonsBounds.Length > 0) 
       cellRectangle.X = buttonsBounds[buttonsBounds.Length - 1].Right; 
    return cellRectangle; 
} 
 
Sample link: GridGroupingControl 
 
Please let us know if we misunderstood your scenario. 
 
Regards, 
Mohanraj G 



GP Gregory Pe replied to Mohanraj Gunasekaran August 14, 2018 08:48 PM UTC

Hi Gregory, 
 
Thanks for your update. 
 
Query 
Solution 
how to enter a large number in colunaNum ColumnName = "quantity"; it must be Type.GetType ("System.Decimal");
to work
 
By default, CalculatorTextBox control type column does not have the support for decimal type. But, you can achieve your scenario by implementing the custom cell renderer for CalculatorTextBox which inherits from GridStaticCellRenderer. Please refer to the below code example, 
 
Code example 
this.gridGroupingControl1.TableControl.CellRenderers["CalculatorTextBox"] = new CustomCalculateTextboxRenderer(this.gridGroupingControl1.TableControl, new DropDownCalculatorTextBoxCellModel(this.gridGroupingControl1.TableModel)); 
 
public class CustomCalculateTextboxRenderer : GridStaticCellRenderer 
{ 
 
    void calci_ValueCalculated(object sender, CalculatorValueCalculatedEventArgs arg) 
    { 
        GridCurrentCell cc = this.Grid.CurrentCell; 
        GridStyleInfo style = this.Grid.Model[cc.RowIndex, cc.ColIndex]; 
        if (style.CellValueType == typeof(Decimal)) 
            style.CellValue = this.calci.Value.ToDecimal(); 
        else if (style.CellValueType == typeof(Double)) 
            style.CellValue = this.calci.Value.ToDouble(); 
        else if (style.CellValueType == typeof(int)) 
            style.CellValue = Convert.ToInt16(this.calci.Value); 
        else 
            style.CellValue = this.calci.Value.ToString(); 
    } 
 
    public override void DropDownContainerShowingDropDown(object sender, System.ComponentModel.CancelEventArgs e) 
    { 
        GridStyleInfo style = this.Grid.Model[RowIndex, ColIndex]; 
        this.calci = style.Control as CalculatorControl; 
        this.calci.ShowDisplayArea = false; 
        this.calci.Size = new Size(260, 180); 
 
        if (this.DropDownContainer != null) 
        { 
            this.DropDownContainer.Controls.Add(this.calci); 
        } 
 
        this.DropDownContainer.Size = this.calci.Size; 
        this.calci.ValueCalculated += new CalculatorValueCalculatedEventHandler(this.calci_ValueCalculated); 
    } 
} 
 
//ButtonAlignment.Left;
 down
Columns [ "item_ValueMember"]
for AutoSuggest to work
 
To use the AutoSuggest option, you could use the DropDownStyle property. Please refer to the below code example, 
 
Code example 
gridGroupingControl1.TableDescriptor.Columns["item_ValueMember"].Appearance.AnyRecordFieldCell.DropDownStyle = GridDropDownStyle.AutoComplete; 
I tried through
  this.gridGroupingControl1.TableDescriptor.Columns ["item_ValueMember_Editor_Cell"]. Appearance.AnyRecordFieldCell.CellType = "ComboBoxButtonEditCell";

but it is not correct

I tried with:
 
 gridGroupingControl1.TableDescriptor.Columns ["Button_Multi"]. Appearance.AnyRecordFieldCell.CellType = "MultipleButton";
and
ridGroupingControl1.TableDescriptor.Columns ["ImmageMulti"]. Appearance.AnyRecordFieldCell.CellType = "MultipleImage";
 
We have analyzed your custom cell model and renderers (ComboBoxButtonEditCell, MultipleButton and MultipleImage). We are little bit unclear about your scenario. Please let us know what kind of issue are you facing when use this custom cell models and custom cell renderers. It will be helpful to proceed further.  
 
In below attached sample, we have implemented the code to align the button as left by overriding the OnLayout method in your custom cell renderer(ComboCellRenderer). Please refer to the below code example, 
 
Code example 
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
{ 
    Rectangle cellRectangle = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
    int buttonWidth = rect.Width; 
    for (int i = 0; i < buttonsBounds.Length; i++) 
    { 
        if (i == 0) 
        { 
            buttonsBounds[i].X = cellRectangle.X; 
        } 
        else 
            buttonsBounds[i].X = buttonsBounds[i - 1].Right; 
    } 
    If(buttonsBounds.Length > 0) 
       cellRectangle.X = buttonsBounds[buttonsBounds.Length - 1].Right; 
    return cellRectangle; 
} 
 
Sample link: GridGroupingControl 
 
Please let us know if we misunderstood your scenario. 
 
Regards, 
Mohanraj G 


Hi 
Mohanraj

works great
thank you

Regards, 
Gregory


MG Mohanraj Gunasekaran Syncfusion Team August 15, 2018 04:26 AM UTC

Hi Gregory, 
 
Thanks for your update. 
 
We are glad to know that your reported problem has resolved. Please let us know if you have any other concerns. 
 
Regards, 
Mohanraj G 



GP Gregory Pe July 4, 2019 07:38 PM UTC

Hi

1.
how to force ImmageMulti and ButtonMulti columns to edit
2
as in the Item_ValueMember column, set the button on the left
and
how to delete names from  GridDropDownStyle.AutoComplete
id2, item2

3
can you add to Item_ValueMember
  "MultipleButton"; or "MultipleImage";
retaining GridCellTypeName.GridListControl;

as it is in the item column


4
what to do if after selecting the button in the Item_ValueMember column and selecting IT9, pressing TAB refreshed
buttonEdit1 and comboBoxAdv1
he does it only after changing the record

5.
https://www.syncfusion.com/kb/6778/how-to-enable-the-button-click-only-on-current-cell-in-edit-mode
RegisterCellModel.GridDataBoundCellType(this.gridDataBoundGrid1, CustomCellTypes.ButtonEdit);
this.gridDataBoundGrid1.TableStyle.CellType = CustomCellTypes.ButtonEdit.ToString();


could it be extended
CustomCellTypes.ButtonEdit);

for additional Adding child buttons

     c #
     vb

private Syncfusion.Windows.Forms.Tools.ButtonEdit buttonEdit1;
private Syncfusion.Windows.Forms.Tools.ButtonEditChildButton buttonEditChildButton1;
private Syncfusion.Windows.Forms.Tools.ButtonEditChildButton buttonEditChildButton2;
private Syncfusion.Windows.Forms.Tools.ButtonEditChildButton buttonEditChildButton3;
this.buttonEdit1 = new Syncfusion.Windows.Forms.Tools.ButtonEdit ();
this.buttonEditChildButton1 = new Syncfusion.Windows.Forms.Tools.ButtonEditChildButton ();
this.buttonEditChildButton2 = new Syncfusion.Windows.Forms.Tools.ButtonEditChildButton ();
this.buttonEditChildButton3 = new Syncfusion.Windows.Forms.Tools.ButtonEditChildButton ();

and put them in GGC





Regards
Gregory

Attachment: test002_c372873e.rar


MG Mohanraj Gunasekaran Syncfusion Team July 5, 2019 01:58 PM UTC

Hi Gregory, 
 
Thanks for using Syncfusion product. 
 
Query 
Response 
how to force ImmageMulti and ButtonMulti columns to edit 
To make a ImmageMulti and ButtonMulti column as editable, you could derive custom cell model and cell renderer from GridTextBoxCellModel and GridTextBoxCellRenderer. Please refer the following code example. 
 
C# 
//ImageMulti column 
public class MultipleImageCellModel : GridTextBoxCellModel 
{} 
public class MultipleImageCellRenderer : GridTextBoxCellRenderer 
{} 
 
//ButtonMulti column 
public class MultipleButtonCellModel : GridTextBoxCellModel 
{} 
public class MultipleButtonCellRenderer : GridTextBoxCellRenderer 
{} 
as in the Item_ValueMember column, set the button on the left
and how to delete names from  GridDropDownStyle.AutoComplete

id2, item2


 
can you add to Item_ValueMember
  "MultipleButton"; or "MultipleImage";
retaining GridCellTypeName.GridListControl;
 
To set the GridListControl dropdown button in left of the column, you could implement the customer cellmodel and custom cell renderer for GridDropDownGridListControlCellModel and GridDropDownGridListControlCellRenderer then override the OnLayout method to change the dropdown button position. Please refer the following code example. 
 
C# 
class GridListCellModel : GridDropDownGridListControlCellModel 
{ 
    public GridListCellModel(GridModel model) : base(model) 
    { 
        ButtonBarSize = new System.Drawing.Size(30, 15); 
    } 
 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new GridListCellRender(control, this); 
    } 
} 
 
class GridListCellRender : GridDropDownGridListControlCellRenderer 
{ 
    public GridCellButton button; 
    public GridListCellRender(GridControlBase grid, GridCellModelBase model) : base(grid, model) 
    { 
        button = new GridCellButton(this); 
        button.Text = "$"; 
 
        //Add the button to the comboBox cell 
        this.AddButton(button); 
 
        //To hide the drop down column header 
        this.ListControlPart.ShowColumnHeader = false; 
 
    } 
 
    protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
    { 
        Rectangle rect = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
        int buttonWidth = rect.Width; 
        for (int i = 0; i < buttonsBounds.Length; i++) 
        { 
            if (i == 0) 
            { 
                buttonsBounds[i].X = rect.X; 
            } 
            else 
                buttonsBounds[i].X = buttonsBounds[i - 1].Right; 
        } 
        rect.X = buttonsBounds[buttonsBounds.Length - 1].Right; 
        return rect; 
    } 
} 
what to do if after selecting the button in the Item_ValueMember column and selecting IT9, pressing TAB refreshed
buttonEdit1 and comboBoxAdv1
 
he does it only after changing the record 
To update the edited value in underlying datasource, you could use the ForceImmediateSavevalue property. Please refer the following code example and the KB link, 
 
C#  
gridGroupingControl1.TableDescriptor.Fields["item_ValueMember"].ForceImmediateSaveValue = true; 
 
KB link: 
https://www.syncfusion.com/kb/6778/how-to-enable-the-button-click-only-on-current-cell-in-edit-mode 
RegisterCellModel.GridDataBoundCellType(this.gridDataBoundGrid1, CustomCellTypes.ButtonEdit); 
this.gridDataBoundGrid1.TableStyle.CellType = CustomCellTypes.ButtonEdit.ToString(); 
 
To add the multiple button you could implement the custom cell model and custom cell renderer for button edit cell. Please refer the following code example. 
 
C# 
class ButtonEditAdvCellModel : ButtonEditCellModel 
{ 
    public ButtonEditAdvCellModel(GridModel model) : base(model) 
    { 
        ButtonBarSize = new System.Drawing.Size(30, 15); 
    } 
 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new ButtonEditAdvCellRenderer(control,this); 
    } 
} 
 
class ButtonEditAdvCellRenderer : ButtonEditCellRenderer 
{ 
    public ButtonEditCellButton button; 
    public ButtonEditCellButton childButton; 
    public ButtonEditAdvCellRenderer(GridControlBase grid, GridTextBoxCellModel model) : base(grid, model) 
    { 
        button = new ButtonEditCellButton(this); 
        childButton = new ButtonEditCellButton(this); 
        AddButton(button); 
        AddButton(childButton); 
    } 
 
    protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
    { 
        Rectangle rect = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
 
        ButtonEditStyleProperties sp = new ButtonEditStyleProperties(style); 
        bool isRightToLeft = false; 
        for (int i = 0; i < buttonsBounds.Length; i++) 
        { 
            if ((this.Grid.RightToLeft == RightToLeft.Inherit && Grid.IsRightToLeft()) || (style.RightToLeft == RightToLeft.Yes)) 
            { 
                isRightToLeft = true; 
            } 
            Rectangle rightArea = Rectangle.Empty; 
            // Here you specify where the button should be drawn within the cell. 
            if (sp.ButtonEditInfo.IsLeft ^ isRightToLeft) 
            { 
                // Draw left 
                if (i == 0) 
                    rightArea = Rectangle.FromLTRB(innerBounds.Left, innerBounds.Top, innerBounds.Left + sp.ButtonEditInfo.Width, innerBounds.Bottom); 
                else 
                    rightArea = Rectangle.FromLTRB(innerBounds.Left, innerBounds.Top, innerBounds.Left + sp.ButtonEditInfo.Width, innerBounds.Bottom); 
                buttonsBounds[0] = GridUtil.CenterInRect(rightArea, new Size(sp.ButtonEditInfo.Width, 20)); 
 
                // Here you return the area where the text should be drawn/edited. 
                innerBounds.Width -= sp.ButtonEditInfo.Width; 
                innerBounds.Offset(sp.ButtonEditInfo.Width, 0); 
            } 
            else 
            { 
                // Draw right 
                if (i == 0) 
                { 
                    // Here you specify where the button should be drawn within the cell. 
                    rightArea = Rectangle.FromLTRB(innerBounds.Right - sp.ButtonEditInfo.Width, innerBounds.Top, innerBounds.Right, innerBounds.Bottom); 
                } 
                else 
                { 
                    // Here you specify where the button should be drawn within the cell. 
                    rightArea = new Rectangle(buttonsBounds[i - 1].X - sp.ButtonEditInfo.Width, buttonsBounds[i - 1].Y, buttonsBounds[i - 1].Width, buttonsBounds[i - 1].Height); 
                } 
                buttonsBounds[i] = GridUtil.CenterInRect(rightArea, new Size(sp.ButtonEditInfo.Width, 20)); 
 
                // Here you return the area where the text should be drawn/edited. 
                innerBounds.Width -= sp.ButtonEditInfo.Width; 
            } 
                
        } 
        return rect; 
    } 
} 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Mohanraj G 



GP Gregory Pe replied to Mohanraj Gunasekaran July 8, 2019 02:26 PM UTC

Hi Gregory, 
 
Thanks for using Syncfusion product. 
 
Query 
Response 
how to force ImmageMulti and ButtonMulti columns to edit 
To make a ImmageMulti and ButtonMulti column as editable, you could derive custom cell model and cell renderer from GridTextBoxCellModel and GridTextBoxCellRenderer. Please refer the following code example. 
 
C# 
//ImageMulti column 
public class MultipleImageCellModel : GridTextBoxCellModel 
{} 
public class MultipleImageCellRenderer : GridTextBoxCellRenderer 
{} 
 
//ButtonMulti column 
public class MultipleButtonCellModel : GridTextBoxCellModel 
{} 
public class MultipleButtonCellRenderer : GridTextBoxCellRenderer 
{} 
as in the Item_ValueMember column, set the button on the left
and how to delete names from  GridDropDownStyle.AutoComplete

id2, item2


 
can you add to Item_ValueMember
  "MultipleButton"; or "MultipleImage";
retaining GridCellTypeName.GridListControl;
 
To set the GridListControl dropdown button in left of the column, you could implement the customer cellmodel and custom cell renderer for GridDropDownGridListControlCellModel and GridDropDownGridListControlCellRenderer then override the OnLayout method to change the dropdown button position. Please refer the following code example. 
 
C# 
class GridListCellModel : GridDropDownGridListControlCellModel 
{ 
    public GridListCellModel(GridModel model) : base(model) 
    { 
        ButtonBarSize = new System.Drawing.Size(30, 15); 
    } 
 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new GridListCellRender(control, this); 
    } 
} 
 
class GridListCellRender : GridDropDownGridListControlCellRenderer 
{ 
    public GridCellButton button; 
    public GridListCellRender(GridControlBase grid, GridCellModelBase model) : base(grid, model) 
    { 
        button = new GridCellButton(this); 
        button.Text = "$"; 
 
        //Add the button to the comboBox cell 
        this.AddButton(button); 
 
        //To hide the drop down column header 
        this.ListControlPart.ShowColumnHeader = false; 
 
    } 
 
    protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
    { 
        Rectangle rect = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
        int buttonWidth = rect.Width; 
        for (int i = 0; i < buttonsBounds.Length; i++) 
        { 
            if (i == 0) 
            { 
                buttonsBounds[i].X = rect.X; 
            } 
            else 
                buttonsBounds[i].X = buttonsBounds[i - 1].Right; 
        } 
        rect.X = buttonsBounds[buttonsBounds.Length - 1].Right; 
        return rect; 
    } 
} 
what to do if after selecting the button in the Item_ValueMember column and selecting IT9, pressing TAB refreshed
buttonEdit1 and comboBoxAdv1
 
he does it only after changing the record 
To update the edited value in underlying datasource, you could use the ForceImmediateSavevalue property. Please refer the following code example and the KB link, 
 
C#  
gridGroupingControl1.TableDescriptor.Fields["item_ValueMember"].ForceImmediateSaveValue = true; 
 
KB link: 
https://www.syncfusion.com/kb/6778/how-to-enable-the-button-click-only-on-current-cell-in-edit-mode 
RegisterCellModel.GridDataBoundCellType(this.gridDataBoundGrid1, CustomCellTypes.ButtonEdit); 
this.gridDataBoundGrid1.TableStyle.CellType = CustomCellTypes.ButtonEdit.ToString(); 
 
To add the multiple button you could implement the custom cell model and custom cell renderer for button edit cell. Please refer the following code example. 
 
C# 
class ButtonEditAdvCellModel : ButtonEditCellModel 
{ 
    public ButtonEditAdvCellModel(GridModel model) : base(model) 
    { 
        ButtonBarSize = new System.Drawing.Size(30, 15); 
    } 
 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new ButtonEditAdvCellRenderer(control,this); 
    } 
} 
 
class ButtonEditAdvCellRenderer : ButtonEditCellRenderer 
{ 
    public ButtonEditCellButton button; 
    public ButtonEditCellButton childButton; 
    public ButtonEditAdvCellRenderer(GridControlBase grid, GridTextBoxCellModel model) : base(grid, model) 
    { 
        button = new ButtonEditCellButton(this); 
        childButton = new ButtonEditCellButton(this); 
        AddButton(button); 
        AddButton(childButton); 
    } 
 
    protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
    { 
        Rectangle rect = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
 
        ButtonEditStyleProperties sp = new ButtonEditStyleProperties(style); 
        bool isRightToLeft = false; 
        for (int i = 0; i < buttonsBounds.Length; i++) 
        { 
            if ((this.Grid.RightToLeft == RightToLeft.Inherit && Grid.IsRightToLeft()) || (style.RightToLeft == RightToLeft.Yes)) 
            { 
                isRightToLeft = true; 
            } 
            Rectangle rightArea = Rectangle.Empty; 
            // Here you specify where the button should be drawn within the cell. 
            if (sp.ButtonEditInfo.IsLeft ^ isRightToLeft) 
            { 
                // Draw left 
                if (i == 0) 
                    rightArea = Rectangle.FromLTRB(innerBounds.Left, innerBounds.Top, innerBounds.Left + sp.ButtonEditInfo.Width, innerBounds.Bottom); 
                else 
                    rightArea = Rectangle.FromLTRB(innerBounds.Left, innerBounds.Top, innerBounds.Left + sp.ButtonEditInfo.Width, innerBounds.Bottom); 
                buttonsBounds[0] = GridUtil.CenterInRect(rightArea, new Size(sp.ButtonEditInfo.Width, 20)); 
 
                // Here you return the area where the text should be drawn/edited. 
                innerBounds.Width -= sp.ButtonEditInfo.Width; 
                innerBounds.Offset(sp.ButtonEditInfo.Width, 0); 
            } 
            else 
            { 
                // Draw right 
                if (i == 0) 
                { 
                    // Here you specify where the button should be drawn within the cell. 
                    rightArea = Rectangle.FromLTRB(innerBounds.Right - sp.ButtonEditInfo.Width, innerBounds.Top, innerBounds.Right, innerBounds.Bottom); 
                } 
                else 
                { 
                    // Here you specify where the button should be drawn within the cell. 
                    rightArea = new Rectangle(buttonsBounds[i - 1].X - sp.ButtonEditInfo.Width, buttonsBounds[i - 1].Y, buttonsBounds[i - 1].Width, buttonsBounds[i - 1].Height); 
                } 
                buttonsBounds[i] = GridUtil.CenterInRect(rightArea, new Size(sp.ButtonEditInfo.Width, 20)); 
 
                // Here you return the area where the text should be drawn/edited. 
                innerBounds.Width -= sp.ButtonEditInfo.Width; 
            } 
                
        } 
        return rect; 
    } 
} 
 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Mohanraj G 


Hi Mohanraj

Thank you for your answer



gridGroupingControl1.TableDescriptor.Columns ["ImmageMulti"]. Appearance.AnyRecordFieldCell.CellType = "MultipleImage"

"MultipleImage" is now a text-picture-picture
1.
  how to add a third image eg>
Image1-text-Image2-Image3
2.
can you do>
Image1-GridListEditCell-Image2-Image3
3.
how to assign to
Image image2
  that the calculator would be the same as in
  gridGroupingControl1.TableDescriptor.Columns ['quantity']

  RegisterCellModel.GridGroupingCellType (this.gridGroupingControl1, CustomCellTypes.CalculatorTextBox);



Regards
Gregory



JP Jagadeesan Pichaimuthu Syncfusion Team July 9, 2019 12:00 PM UTC

Hi Gregory, 
  
Thanks for your update. 
  
Query 
Response 
how to add a third image eg> Image1-text-Image2-Image3 
To achieve all this case by overriding the OnLayout method in custom cell renderers. By this method, you could adjust the button where should it be aligned.  We have modified the sample with your requested requirement. Please refer the following attached sample. 
can you do> Image1-GridListEditCell-Image2-Image3 
how to assign to
Image image2
 
  
  
Please get back to us if you need any further assistance on this. 
  
Regards, 
Jagadeesan 



GP Gregory Pe replied to Jagadeesan Pichaimuthu July 9, 2019 07:59 PM UTC

Hi Gregory, 
  
Thanks for your update. 
  
Query 
Response 
how to add a third image eg> Image1-text-Image2-Image3 
To achieve all this case by overriding the OnLayout method in custom cell renderers. By this method, you could adjust the button where should it be aligned.  We have modified the sample with your requested requirement. Please refer the following attached sample. 
can you do> Image1-GridListEditCell-Image2-Image3 
how to assign to
Image image2
 
  
  
Please get back to us if you need any further assistance on this. 
  
Regards, 
Jagadeesan 



 Hi, Jagadeesan


thank you for the answer
1
I am asking you for help in the column
"quantity" was an editing option

and
2
  how to do that after clicking on the "item_ValueMember" column in the $ or @ button
opened up - MessageBox.Show
but he did not develop this.ListControlPart
only if he clicks on ListControl - he should develop
3
can you do> Image1-GridListEditCell-Image2-Image3  IN  "item_ValueMember"   - please change thebutton for Image


Regards,
Gregory


DB Dinesh Babu Yadav Syncfusion Team July 10, 2019 11:44 AM UTC

Hi Gregory, 
  
Thanks for the update. 
  
  1. I am asking you for help in the column "quantity" was an editing option
The Quantity column cell type was set as StaticCell in the provided sample. In order to make the cell as editable, the CellModel of the column can be overridden from the GridTextBoxCellModel. (i.e. CustomCaculateTextBoxModel has to be overridden from the GridTextBoxCellModel). 
  
Code example 
  
public class CustomCaculateTextBoxModel : GridTextBoxCellModel  
{ 
    public CustomCaculateTextBoxModel(GridModel model):base(model) 
    { 
        ButtonBarSize = new Size(30, 15); 
    } 
} 
  1. how to do that after clicking on the "item_ValueMember" column in the $ or @ button opened up - MessageBox.Show but he did not develop this.ListControlPart only if he clicks on ListControl - he should develop
The GridCellButtonClick event can be handled based on the condition to show either the MessageBox or DropDown for the specified button. Please refer to the below code changes, 
  
Code example 
  
void gridGroupingControl11_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) 
{//dodaj  multi 
    GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); 
    int recordNumber = style.TableCellIdentity.DisplayElement.GetRecord().GetSourceIndex() + 1; 
  
    if(style.TableCellIdentity.Column.MappingName == "item_ValueMember") 
    { 
        if (e.Inner.Button.Text == "Image1" && e.Inner.Button.Text == "Image2" && e.Inner.Button.Text == "Image3") 
            MessageBox.Show("CellType:" + style.CellType.ToString() + "\nClicked Button: " + e.Inner.Button.Text + "\nRecord Number: " + recordNumber.ToString() + "\nRow Index: " + e.Inner.RowIndex + "\nColumn Index: " + e.Inner.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
        else 
            e.Inner.Cancel = true; 
    } 
    else 
        MessageBox.Show("CellType:" + style.CellType.ToString() + "\nClicked Button: " + e.Inner.Button.Text + "\nRecord Number: " + recordNumber.ToString() + "\nRow Index: " + e.Inner.RowIndex + "\nColumn Index: " + e.Inner.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
} 
  1. can you do> Image1-GridListEditCell-Image2-Image3  IN  "item_ValueMember"   - please change thebutton for Image
The MultipleImageCell can be used instead of GridCellButton in GridListCellModel to load the image in the buttons. 
  
Code example 
  
MultipleImageCell[] mybuttons; 
  
public GridListCellRender(GridControlBase grid, GridCellModelBase model) : base(grid, model) 
{ 
    Image image1 = Image.FromFile(@"..\\..\\delete.png"); 
    Image image2 = Image.FromFile(@"..\\..\\basic.png"); 
    Image image3 = Image.FromFile(@"..\\..\\disk_blue.png"); 
    mybuttons = new MultipleImageCell[3]; 
    mybuttons[0] = new MultipleImageCell(this, image1); 
    mybuttons[0].Text = "Image1"; 
    mybuttons[1] = new MultipleImageCell(this, image2); 
    mybuttons[1].Text = "Image2"; 
    mybuttons[2] = new MultipleImageCell(this, image3); 
    mybuttons[2].Text = "Image3"; 
    AddButton(mybuttons[0]); 
    AddButton(mybuttons[1]); 
    AddButton(mybuttons[2]); 
  
    //To hide the drop down column header 
    this.ListControlPart.ShowColumnHeader = false; 
  
} 
  
  
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 



GP Gregory Pe replied to Dinesh Babu Yadav July 11, 2019 01:37 PM UTC

Hi Gregory, 
  
Thanks for the update. 
  
  1. I am asking you for help in the column "quantity" was an editing option
The Quantity column cell type was set as StaticCell in the provided sample. In order to make the cell as editable, the CellModel of the column can be overridden from the GridTextBoxCellModel. (i.e. CustomCaculateTextBoxModel has to be overridden from the GridTextBoxCellModel). 
  
Code example 
  
public class CustomCaculateTextBoxModel : GridTextBoxCellModel  
{ 
    public CustomCaculateTextBoxModel(GridModel model):base(model) 
    { 
        ButtonBarSize = new Size(30, 15); 
    } 
} 
  1. how to do that after clicking on the "item_ValueMember" column in the $ or @ button opened up - MessageBox.Show but he did not develop this.ListControlPart only if he clicks on ListControl - he should develop
The GridCellButtonClick event can be handled based on the condition to show either the MessageBox or DropDown for the specified button. Please refer to the below code changes, 
  
Code example 
  
void gridGroupingControl11_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) 
{//dodaj  multi 
    GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); 
    int recordNumber = style.TableCellIdentity.DisplayElement.GetRecord().GetSourceIndex() + 1; 
  
    if(style.TableCellIdentity.Column.MappingName == "item_ValueMember") 
    { 
        if (e.Inner.Button.Text == "Image1" && e.Inner.Button.Text == "Image2" && e.Inner.Button.Text == "Image3") 
            MessageBox.Show("CellType:" + style.CellType.ToString() + "\nClicked Button: " + e.Inner.Button.Text + "\nRecord Number: " + recordNumber.ToString() + "\nRow Index: " + e.Inner.RowIndex + "\nColumn Index: " + e.Inner.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
        else 
            e.Inner.Cancel = true; 
    } 
    else 
        MessageBox.Show("CellType:" + style.CellType.ToString() + "\nClicked Button: " + e.Inner.Button.Text + "\nRecord Number: " + recordNumber.ToString() + "\nRow Index: " + e.Inner.RowIndex + "\nColumn Index: " + e.Inner.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
} 
  1. can you do> Image1-GridListEditCell-Image2-Image3  IN  "item_ValueMember"   - please change thebutton for Image
The MultipleImageCell can be used instead of GridCellButton in GridListCellModel to load the image in the buttons. 
  
Code example 
  
MultipleImageCell[] mybuttons; 
  
public GridListCellRender(GridControlBase grid, GridCellModelBase model) : base(grid, model) 
{ 
    Image image1 = Image.FromFile(@"..\\..\\delete.png"); 
    Image image2 = Image.FromFile(@"..\\..\\basic.png"); 
    Image image3 = Image.FromFile(@"..\\..\\disk_blue.png"); 
    mybuttons = new MultipleImageCell[3]; 
    mybuttons[0] = new MultipleImageCell(this, image1); 
    mybuttons[0].Text = "Image1"; 
    mybuttons[1] = new MultipleImageCell(this, image2); 
    mybuttons[1].Text = "Image2"; 
    mybuttons[2] = new MultipleImageCell(this, image3); 
    mybuttons[2].Text = "Image3"; 
    AddButton(mybuttons[0]); 
    AddButton(mybuttons[1]); 
    AddButton(mybuttons[2]); 
  
    //To hide the drop down column header 
    this.ListControlPart.ShowColumnHeader = false; 
  
} 
  
  
Please let us know if you require further assistance. 
 
Regards, 
Dinesh Babu Yadav 
 


Hi, Dinesh Babu Yadav

thank you for the answer
ad
I am asking you for help in the column "quantity" was an editing option


problem - edit works but can not be entered from the keyboard



Regards, 
Gregory


SP Subburaj Pandian Veluchamy Syncfusion Team July 12, 2019 12:29 PM UTC

Hi Gregory, 
  
Sorry for the inconvenience caused. 
  
To save the value for quantity column using keyboard, you could make the changes in OnSaveChanges method of CustomCalculateTextboxRenderer. Please refer the following code example and the sample. 
  
[C#] 
protected override bool OnSaveChanges() 
{ 
    if (this.calci != null) 
    { 
        Grid.Model[RowIndex, ColIndex].CellValue = this.calci.Value; 
        return true; 
    } 
    else 
        return base.OnSaveChanges(); 
} 
  
  
Please get back to us if you need any further assistance on this. 
 
Regards,
Subburaj Pandian V 



GP Gregory Pe replied to Subburaj Pandian Veluchamy November 13, 2019 07:58 PM UTC

Hi Gregory, 
  
Sorry for the inconvenience caused. 
  
To save the value for quantity column using keyboard, you could make the changes in OnSaveChanges method of CustomCalculateTextboxRenderer. Please refer the following code example and the sample. 
  
[C#] 
protected override bool OnSaveChanges() 
{ 
    if (this.calci != null) 
    { 
        Grid.Model[RowIndex, ColIndex].CellValue = this.calci.Value; 
        return true; 
    } 
    else 
        return base.OnSaveChanges(); 
} 
  
  
Please get back to us if you need any further assistance on this. 
 
Regards,
Subburaj Pandian V 


Hi
1.
in the price column
depending on the settings
Image1_VISIBLE_checkBox 
Image2_VISIBLE_checkBox
Image3_VISIBLE_checkBox

after pressing
button2 "MultipleImage in price"

sets
Image buttons visible or hidden

Image1 - should work like this GridShowButtons.ShowCurrentCellEditing;
Image2 - should work like this GridShowButtons.ShowCurrentCellEditing
Image3 - should work like this GridShowButtons.ShowCurrentCellEditing

2.
how do you not to ruin the Currency format .CellType = GridCellTypeName.Currency;

3.

after pressing
button3 "MultipleImage in MultipleImage"

like in point 1

With this difference
Image1 - should work like this GridShowButtons.Show;
Image2 - should work like this GridShowButtons.ShowCurrentCellEditing
Image3 - should work like this GridShowButtons.ShowCurrentCellEditing

4
How to remove error
in the "quantity" column you can change the ala value after running the calculator anymore
unable to enter value

please also pay attention that in point 1 after calling calculator in Image3 you can also enter any numbers








Regards
Gregory

Attachment: test002__Copy_c5d6a951.rar


AR Arulpriya Ramalingam Syncfusion Team November 14, 2019 05:05 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
1. 
in the price column
depending on the settings
 
Image1_VISIBLE_checkBox  
Image2_VISIBLE_checkBox 
Image3_VISIBLE_checkBox 

 

after pressing 
button2 "MultipleImage in price" 

sets
Image buttons visible or hidden
 

Image1 - should work like this GridShowButtons.ShowCurrentCellEditing; 
Image2 - should work like this GridShowButtons.ShowCurrentCellEditing
Image3 - should work like this GridShowButtons.ShowCurrentCellEditing 
 
The OnLayOut method of the MultiImageCellRenderer can be customized to align the images based on conditions. We have added flags to check whether the checkboxes are checked or not and updated the GridCell based on the flag. Please make use of the below code and sample to achieve this at your end. 
 
Code example 
 
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
{ 
    var rectangle = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds); 
    for (int i = 0; i < buttonsBounds.Length; i++) 
    { 
        if (colIndex != 8 || i == 0 || (CurrentCell.IsEditing && CurrentCell.RowIndex == rowIndex)) 
        { 
            rectangle = GetRectangle(rectangle, buttonsBounds, visibleArray[i], i); 
        } 
        else 
        { 
            rectangle = GetRectangle(rectangle, buttonsBounds, false, i); 
        } 
    } 
    return rectangle; 
} 
2.
how do you not to ruin the Currency format .CellType = GridCellTypeName.Currency; 
 
This can be achieved by setting the Format for the column as currency and refer to the below code for further reference. 
 
Code example 
 
gridGroupingControl1.TableDescriptor.Columns["price"].Appearance.AnyRecordFieldCell.CellType = "MultipleImage"; 
//To set the format as currency. 
gridGroupingControl1.TableDescriptor.Columns["price"].Appearance.AnyRecordFieldCell.Format = "$ ##,##.##"; 
 
3. 

after pressing 

 
button3 "MultipleImage in MultipleImage" 

like in point 1 
 
With this difference 
Image1 - should work like this GridShowButtons.Show; 
Image2 - should work like this GridShowButtons.ShowCurrentCellEditing
Image3 - should work like this GridShowButtons.ShowCurrentCellEditing 
 
By default, the ShowButtons option will work for all the CellButtons in a cell. In order to achieve this scenario, we would suggest that you to set the ShowButtons option as Show for the column and the alignments can be customized using OnLayout method. 
 
Code example 
 
//To provide enough space align the images. 
gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Width = 150; 
//To show the 1st image always.  
gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Appearance.AnyRecordFieldCell.CellType = "MultipleImage"; 
gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Appearance.AnyRecordFieldCell.ShowButtons =GridShowButtons.Show; 
 
//add customization of OnLayout. 
4
How to remove error
in the "quantity" column you can change the ala value after running the calculator anymore
unable to enter value

 
CellValue for the Quantity column is assigned as CalculateValue instead of decimal value in the OnSaveChanges() method of CustomCalculateTextBoxRenderer. We have modified the sample with this case and refer to the below code. 
 
Code example 
private object GetCellValue(GridStyleInfo style) 
{ 
    if (style.CellValueType == typeof(Decimal)) 
        return this.calci.Value.ToDecimal(); 
    else if (style.CellValueType == typeof(Double)) 
        return this.calci.Value.ToDouble(); 
    else if (style.CellValueType == typeof(int)) 
        return Convert.ToInt16(this.calci.Value); 
    else 
        return this.calci.Value.ToString(); 
} 
 
protected override bool OnSaveChanges() 
{ 
    if (this.calci != null) 
    { 
        GridStyleInfo style = Grid.Model[RowIndex, ColIndex]; 
        if (isEdited && this.ControlValue != GetCellValue(style)) 
            Grid.Model[RowIndex, ColIndex].CellValue = this.ControlText; 
        else 
            Grid.Model[RowIndex, ColIndex].CellValue = GetCellValue(style); 
        return true; 
    } 
    else 
        return base.OnSaveChanges(); 
} 
 
please also pay attention that in point 1 after calling calculator in Image3 you can also enter any numbers 
We are validating on this scenario with high priority and we need some more time to look into the sample thoroughly to find the root cause of the use case and we will update you the proper details on tomorrow 15th November, 2019. 
 
We appreciate your patience till then and get back to us, if you need any assistance in the meanwhile. 
 
 
 
Arulpriya 



AR Arulpriya Ramalingam Syncfusion Team November 15, 2019 11:39 AM UTC

Hi Gregory, 
 
Thank you for your patience. 
 
please also pay attention that in point 1 after calling calculator in Image3 you can also enter any numbers  
Control of CurrentCellRenderer has focus when opening/showing the MessageBox for Image3 button click and which caused the reported scenario at your end. In order to overcome this use case, the Lost_Focus for the control in renderer can be called by invoking the CurrentCell.EndEdit() method and move the focus to the control after the MessageBox is closed by using CurrentCell.BeginEdit(). Make use of the below code and modified sample. 
 
Code example 
 
void gridGroupingControl11_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) 
{ 
//Some code to show messagebox for item valuemember column. 
    if (style.TableCellIdentity.Column.MappingName == "price") 
    { 
        if (e.Inner.Button.Text == "Image3") 
        { 
            //To loss the focus for renderer 
            e.TableControl.CurrentCell.EndEdit(); 
            if (MessageBox.Show("Calculate") == DialogResult.OK) 
            { 
                //To start editing for the CurrentCell 
                e.TableControl.CurrentCell.BeginEdit(); 
            } 
            //MessageBox.Show("Calculator"); 
        } 
 
    } 
    else 
        MessageBox.Show("CellType:" + style.CellType.ToString() + "\nClicked Button: " + e.Inner.Button.Text + "\nRecord Number: " + recordNumber.ToString() + "\nRow Index: " + e.Inner.RowIndex + "\nColumn Index: " + e.Inner.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
} 
 
 
If you have any other queries, please get back to us. 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 18, 2019 07:52 AM UTC

Hi Gregory, 
 
Thank you for your patience. 
 
please also pay attention that in point 1 after calling calculator in Image3 you can also enter any numbers  
Control of CurrentCellRenderer has focus when opening/showing the MessageBox for Image3 button click and which caused the reported scenario at your end. In order to overcome this use case, the Lost_Focus for the control in renderer can be called by invoking the CurrentCell.EndEdit() method and move the focus to the control after the MessageBox is closed by using CurrentCell.BeginEdit(). Make use of the below code and modified sample. 
 
Code example 
 
void gridGroupingControl11_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) 
{ 
//Some code to show messagebox for item valuemember column. 
    if (style.TableCellIdentity.Column.MappingName == "price") 
    { 
        if (e.Inner.Button.Text == "Image3") 
        { 
            //To loss the focus for renderer 
            e.TableControl.CurrentCell.EndEdit(); 
            if (MessageBox.Show("Calculate") == DialogResult.OK) 
            { 
                //To start editing for the CurrentCell 
                e.TableControl.CurrentCell.BeginEdit(); 
            } 
            //MessageBox.Show("Calculator"); 
        } 
 
    } 
    else 
        MessageBox.Show("CellType:" + style.CellType.ToString() + "\nClicked Button: " + e.Inner.Button.Text + "\nRecord Number: " + recordNumber.ToString() + "\nRow Index: " + e.Inner.RowIndex + "\nColumn Index: " + e.Inner.ColIndex, "Click Information", MessageBoxButtons.OK, MessageBoxIcon.Information); 
} 
 
 
If you have any other queries, please get back to us. 
 
Regards, 
Arulpriya 


Hi
Thank you with your reply

1. can you remove the left shift (margin) of the displayed number in the "quantity" and "ImmageMulti" columns
2. can parameters be separated?
 private void button2_Click(object sender, EventArgs e)
        {
            MultipleImageCellRenderer renderer1 = gridGroupingControl1.TableControl.CellRenderers["MultipleImage"] as MultipleImageCellRenderer;
            renderer1.Image1_Visible = Image1_checkBox.Checked;
            renderer1.Image2_Visible = Image2_checkBox.Checked;
            renderer1.Image3_Visible = Image3_checkBox.Checked;
            gridGroupingControl1.TableDescriptor.Columns["price"].Appearance.AnyRecordFieldCell.CellType = "MultipleImage"; // MultipleImage in price
            //To set the format as currency.
            gridGroupingControl1.TableDescriptor.Columns["price"].Appearance.AnyRecordFieldCell.Format = "$ ##,##.##";
            gridGroupingControl1.TableDescriptor.Columns["price"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.ShowCurrentCellEditing;// GridShowButtons.Show;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MultipleImageCellRenderer renderer = gridGroupingControl1.TableControl.CellRenderers["MultipleImage"] as MultipleImageCellRenderer;
            renderer.Image1_Visible = Image1_checkBox.Checked;
            renderer.Image2_Visible = Image2_checkBox.Checked;
            renderer.Image3_Visible = Image3_checkBox.Checked;
            //To show the 1st image always.
            gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Appearance.AnyRecordFieldCell.CellType = "MultipleImage";
            gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Show;
        }

despite the change
last option overwriting Image display properties

if i set
Image1_checkBox.Checked false
Image2_checkBox.Checked true
Image2_checkBox.Checked true

I press
button2_Click - "price"

if i set
Image1_checkBox.Checked true
Image2_checkBox.Checked true
Image2_checkBox.Checked false

I press
button3_Click - "ImmageMulti"

then changes and overwrites the settings for the "price" column

is there a way to make the settings id individual for each column

Regards
Gregory



AR Arulpriya Ramalingam Syncfusion Team November 19, 2019 08:58 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We are unclear your requirement and suspect that you are trying the align the text at the right side of the cell. In the Quantity column, the numeric values are already aligned at right of the cell. For ImmageMulti column, the Text can be alinged at the right by using the HorizontalAlingement property. Please refer to the below code example. 
 
Example code 
//To align the text at right side of the cell. 
gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Right; 
 
If we misunderstood your scenario, please get back to us with simple screenshot that demonstrates your requirement. 
 
2. can parameters be separated? 
CellRenderes for both columns “price” and “ImmageMulti” are same which caused the reported use case. In order to render the buttons based on checkbox states of each invidual columns, a public method can be added in the renderer to get the column name checked state of CheckBoxes. Using the check state the buttons can arranged in OnLayout() method. We have modified the project and please make use of the code and sample. 
 
Example code 
/// <summary> 
/// Sets the check state for different columns. 
/// </summary> 
public void SetVisible(bool image1_Visible, bool image2_Visible, bool image3_Visible, string columnName) 
{ 
    if (columnName == "price") 
        visibleArrayPrice = new bool[] { image1_Visible, image2_Visible, image3_Visible }; 
    else 
        visibleArrayMultiImage = new bool[] { image1_Visible, image2_Visible, image3_Visible }; 
} 
 
//Need to register the checkbox state for both columns 
MultipleImageCellRenderer renderer = gridGroupingControl1.TableControl.CellRenderers["MultipleImage"] as MultipleImageCellRenderer; 
if (renderer != null) 
{ 
    renderer.SetVisible(Image1_checkBox.Checked, Image2_checkBox.Checked, Image3_checkBox.Checked, "ImmageMulti"); 
} 
 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 19, 2019 10:10 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We are unclear your requirement and suspect that you are trying the align the text at the right side of the cell. In the Quantity column, the numeric values are already aligned at right of the cell. For ImmageMulti column, the Text can be alinged at the right by using the HorizontalAlingement property. Please refer to the below code example. 
 
Example code 
//To align the text at right side of the cell. 
gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Right; 
 
If we misunderstood your scenario, please get back to us with simple screenshot that demonstrates your requirement. 
 
2. can parameters be separated? 
CellRenderes for both columns “price” and “ImmageMulti” are same which caused the reported use case. In order to render the buttons based on checkbox states of each invidual columns, a public method can be added in the renderer to get the column name checked state of CheckBoxes. Using the check state the buttons can arranged in OnLayout() method. We have modified the project and please make use of the code and sample. 
 
Example code 
/// <summary> 
/// Sets the check state for different columns. 
/// </summary> 
public void SetVisible(bool image1_Visible, bool image2_Visible, bool image3_Visible, string columnName) 
{ 
    if (columnName == "price") 
        visibleArrayPrice = new bool[] { image1_Visible, image2_Visible, image3_Visible }; 
    else 
        visibleArrayMultiImage = new bool[] { image1_Visible, image2_Visible, image3_Visible }; 
} 
 
//Need to register the checkbox state for both columns 
MultipleImageCellRenderer renderer = gridGroupingControl1.TableControl.CellRenderers["MultipleImage"] as MultipleImageCellRenderer; 
if (renderer != null) 
{ 
    renderer.SetVisible(Image1_checkBox.Checked, Image2_checkBox.Checked, Image3_checkBox.Checked, "ImmageMulti"); 
} 
 
 
Regards, 
Arulpriya 


Hi Arulpriya
ad.1
not to move the text
and numbers after clicking

not_to_move_51973bf0.rar

Regards,
Gregory

Attachment: not_to_move_51973bf0.rar


AR Arulpriya Ramalingam Syncfusion Team November 19, 2019 11:18 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We are unclear of the use case from the provided image and please confirm us that whether your requirement is correct by referring the below screenshot. 
 
Screenshot 
 
 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 19, 2019 11:29 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We are unclear of the use case from the provided image and please confirm us that whether your requirement is correct by referring the below screenshot. 
 
Screenshot 
 
 
Arulpriya 


Hi Arulpriya
I confirm
need to render the value as not-editing
1. to not change when it is in editing - it should remain as it is not edit

need to remove the space
2. Remove the space space

Regards
Gregory


AR Arulpriya Ramalingam Syncfusion Team November 20, 2019 09:59 AM UTC

Hi Gregory, 
 
Thank you for the confirmation. 
 
We have analyzed the sample thoroughly and found that the rectangle in OnLayout() method retrieved from the base class (i.e, GridTextBoxCellRenderer), which returns the converted text rectangle by eliminating the buttons range. We used the final rectangle to adjust the buttons and that caused the use case in the sample. In order to overcome this scenario, the InnerBounds can be used to adjust the image buttons bounds and text area. We have modified the sample based on your requirement and please make use of the below code. 
 
Example code 
 
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
{  
    //To parse the innerbounds as rectangle to adjust the button bounds with text area. 
    Rectangle rectangle = innerBounds; 
    for (int i = 0; i < buttonsBounds.Length; i++) 
    { 
      //Some code to adjust the widths. 
    } 
} 
private Rectangle GetRectangle(Rectangle rectangle, Rectangle[] buttonsBounds, bool isShow, int index) 
{ 
    if (isShow) 
    { 
        //To get proper text rectangle. 
        buttonsBounds[index] = new Rectangle(rectangle.X, rectangle.Y, this.Model.ButtonBarSize.Width, this.Model.ButtonBarSize.Height); 
        rectangle.X += buttonsBounds[index].Width; 
        rectangle.Width -= (buttonsBounds[index].Width); 
    } 
} 
 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 20, 2019 05:14 PM UTC

Hi Gregory, 
 
Thank you for the confirmation. 
 
We have analyzed the sample thoroughly and found that the rectangle in OnLayout() method retrieved from the base class (i.e, GridTextBoxCellRenderer), which returns the converted text rectangle by eliminating the buttons range. We used the final rectangle to adjust the buttons and that caused the use case in the sample. In order to overcome this scenario, the InnerBounds can be used to adjust the image buttons bounds and text area. We have modified the sample based on your requirement and please make use of the below code. 
 
Example code 
 
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
{  
    //To parse the innerbounds as rectangle to adjust the button bounds with text area. 
    Rectangle rectangle = innerBounds; 
    for (int i = 0; i < buttonsBounds.Length; i++) 
    { 
      //Some code to adjust the widths. 
    } 
} 
private Rectangle GetRectangle(Rectangle rectangle, Rectangle[] buttonsBounds, bool isShow, int index) 
{ 
    if (isShow) 
    { 
        //To get proper text rectangle. 
        buttonsBounds[index] = new Rectangle(rectangle.X, rectangle.Y, this.Model.ButtonBarSize.Width, this.Model.ButtonBarSize.Height); 
        rectangle.X += buttonsBounds[index].Width; 
        rectangle.Width -= (buttonsBounds[index].Width); 
    } 
} 
 
 
Regards, 
Arulpriya 


Hi Arulpriya
1.works great - thank you
2. how to cause instead of MessageBox.Show ("Calculate")
CalculatorValueCalculatedEventArgs was running
just like in "quantity"
 if (style.TableCellIdentity.Column.MappingName == "price")
            {
                if (e.Inner.Button.Text == "Image3")
                {
                    //To loss the focus for renderer
                    e.TableControl.CurrentCell.EndEdit();
                    if (MessageBox.Show("Calculate") == DialogResult.OK)
                    {
                        //To start editing for the CurrentCell
                        e.TableControl.CurrentCell.BeginEdit();
                    }
                    //MessageBox.Show("Calculator");
                }

            }

3.after clicking on the hidden area the button still works.
How to block it

event recorded in the movie



Regards,
Gregory


GP Gregory Pe replied to Gregory Pelczar November 20, 2019 05:22 PM UTC

Hi Gregory, 
 
Thank you for the confirmation. 
 
We have analyzed the sample thoroughly and found that the rectangle in OnLayout() method retrieved from the base class (i.e, GridTextBoxCellRenderer), which returns the converted text rectangle by eliminating the buttons range. We used the final rectangle to adjust the buttons and that caused the use case in the sample. In order to overcome this scenario, the InnerBounds can be used to adjust the image buttons bounds and text area. We have modified the sample based on your requirement and please make use of the below code. 
 
Example code 
 
protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds) 
{  
    //To parse the innerbounds as rectangle to adjust the button bounds with text area. 
    Rectangle rectangle = innerBounds; 
    for (int i = 0; i < buttonsBounds.Length; i++) 
    { 
      //Some code to adjust the widths. 
    } 
} 
private Rectangle GetRectangle(Rectangle rectangle, Rectangle[] buttonsBounds, bool isShow, int index) 
{ 
    if (isShow) 
    { 
        //To get proper text rectangle. 
        buttonsBounds[index] = new Rectangle(rectangle.X, rectangle.Y, this.Model.ButtonBarSize.Width, this.Model.ButtonBarSize.Height); 
        rectangle.X += buttonsBounds[index].Width; 
        rectangle.Width -= (buttonsBounds[index].Width); 
    } 
} 
 
 
Regards, 
Arulpriya 


Hi Arulpriya
1.works great - thank you
2. how to cause instead of MessageBox.Show ("Calculate")
CalculatorValueCalculatedEventArgs was running
just like in "quantity"
 if (style.TableCellIdentity.Column.MappingName == "price")
            {
                if (e.Inner.Button.Text == "Image3")
                {
                    //To loss the focus for renderer
                    e.TableControl.CurrentCell.EndEdit();
                    if (MessageBox.Show("Calculate") == DialogResult.OK)
                    {
                        //To start editing for the CurrentCell
                        e.TableControl.CurrentCell.BeginEdit();
                    }
                    //MessageBox.Show("Calculator");
                }

            }

3.after clicking on the hidden area the button still works.
How to block it

event recorded in the movie



Regards,
Gregory

Hi Arulpriya
3.after clicking on the hidden area the button still works.
How to block it

event recorded in the movie


Regards
Gregory

Attachment: test_3_493e077e.rar


AR Arulpriya Ramalingam Syncfusion Team November 21, 2019 06:53 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
how to cause instead of MessageBox.Show ("Calculate") 
CalculatorValueCalculatedEventArgs was running 
just like in "quantity" 
DropDownContainerShowingDropDown event can be overridden in MultipleImageCellRenderer.cs file and the calculator control can be shown at your end using the code implemented in CustomCalculateTextBoxRenderer.cs.  
 
Please get back to us with the code, if you are facing any hurdles while implementing it. 
after clicking on the hidden area the button still works. 
How to block it 
By default, the GridCellButtonClick event will trigger when a cell button is clicked on any cell. In order to avoid opening messagebox when an inactive cell button is clicked, the TableControlCellButtonClicked can be handled by checking whether the button is clicked on currentcell. Please implement the below code in gridGroupingControl11_TableControlCellButtonClicked event. 
 
Example code 
 
void gridGroupingControl11_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e) 
{//dodaj  multi 
    GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex); 
    int recordNumber = style.TableCellIdentity.DisplayElement.GetRecord().GetSourceIndex() + 1; 
    //To check whether the button belongs to current cell 
    if (e.Inner.RowIndex == e.TableControl.CurrentCell.RowIndex && e.Inner.ColIndex == e.TableControl.CurrentCell.ColIndex) 
    { 
        if (style.TableCellIdentity.Column.MappingName == "item_ValueMember") 
        { 
                 //Some code to perform actions button click. 
                } 
         } 
} 
 
Please get back to us, if you need any further assistance on this. 
 
Regards, 
Arulpriya 



GP Gregory Pe November 25, 2019 07:59 PM UTC

Hi

 protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleInfo style, Rectangle innerBounds, Rectangle[] buttonsBounds)
        {
            //var rectangle = base.OnLayout(rowIndex, colIndex, style, innerBounds, buttonsBounds);
            //To parse the innerbounds as rectangle to adjust the button bounds with text area.
            Rectangle rectangle = innerBounds;
            for (int i = 0; i < buttonsBounds.Length; i++)
            {


                //string test_tag = gridGroupingControl1.TableDescriptor.Columns["ImmageMulti"].HeaderImage.Tag.ToString();
                //string test_tag = gridGroupingControl1.TableDescriptor.Columns["price"].HeaderImage.Tag.ToString();

                //   how to read here gridGroupingControl1.TableDescriptor.Columns[colIndex].HeaderImage.Tag.ToString();
                string HeaderImage_Tag = gridGroupingControl1.TableDescriptor.Columns[colIndex].HeaderImage.Tag.ToString();


                if (colIndex != 8)
                {
                    rectangle = GetRectangle(rectangle, buttonsBounds, visibleArrayPrice[i], i);
                }
                else if (i == 0 || (CurrentCell.IsEditing && CurrentCell.RowIndex == rowIndex))
                {
                    rectangle = GetRectangle(rectangle, buttonsBounds, visibleArrayMultiImage[i], i);
                }
                else
                {
                    rectangle = GetRectangle(rectangle, buttonsBounds, false, i);
                }
            }
            return rectangle;
        }


Regards
Gregory



Attachment: test002__Copy_693fe74.rar


AR Arulpriya Ramalingam Syncfusion Team November 26, 2019 06:36 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
HeaderImage can be retrieved from columns collection by typecasting the Grid as GridTableControl. Also, the actual index for the columns should be retrieved by using ColIndexToField method since, the grid column index are different from GridColumnsCollection index. Please make use of the below code and sample. 
 
Example code 
 
//   how to read here HeaderImage.Tag; 
GridTableDescriptor descriptor = (Grid as GridTableControl).TableDescriptor; 
int actualIndex = descriptor.ColIndexToField(colIndex); 
string HeaderImage_Tag = descriptor.Columns[actualIndex].HeaderImage.Tag.ToString();  
//or 
//descriptor.Columns["price"].HeaderImage.Tag.ToString(); 
 
 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 28, 2019 02:12 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
HeaderImage can be retrieved from columns collection by typecasting the Grid as GridTableControl. Also, the actual index for the columns should be retrieved by using ColIndexToField method since, the grid column index are different from GridColumnsCollection index. Please make use of the below code and sample. 
 
Example code 
 
//   how to read here HeaderImage.Tag; 
GridTableDescriptor descriptor = (Grid as GridTableControl).TableDescriptor; 
int actualIndex = descriptor.ColIndexToField(colIndex); 
string HeaderImage_Tag = descriptor.Columns[actualIndex].HeaderImage.Tag.ToString();  
//or 
//descriptor.Columns["price"].HeaderImage.Tag.ToString(); 
 
 
Arulpriya 


Hi,

how you can attach multipleImageCell to a column ["CheckBox"] and GridCellTypeName.CheckBox;
after pressing
  private void button4_Click (object sender, EventArgs e)
         {
             // Checkbox
             gridGroupingControl1.TableDescriptor.Columns ["CheckBox"]. Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox;
             gridGroupingControl1.TableDescriptor.Columns ["CheckBox"]. Appearance.AnyRecordFieldCell.CheckBoxOptions = new GridCheckBoxCellInfo ("1", "0", "-1", true);
             gridGroupingControl1.TableDescriptor.Columns ["CheckBox"]. Appearance.AnyRecordFieldCell.Description = "1/0";
         }



so that it was in the cell
MultipleImageCell (this, image1) + GridCellTypeName.CheckBox


Regards
Gregory

Attachment: test002__Copy_9931a1c2.rar


AR Arulpriya Ramalingam Syncfusion Team November 29, 2019 01:10 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We have analyzed you query and suspect that you are trying to add the buttons in the order of 3 image, description and checkbox in a cell. This can be achieved by creating a custom CheckBoxCellRenderer and the button bounds can be adjusted to render the buttons. We have created a simple sample to achieve the scenario and please make use of below sample code. 
 
Example code 
 
public class CheckBoxCellRenderer : GridCheckBoxCellRenderer 
{ 
    MultipleImageCell[] mybuttons; 
    public CheckBoxCellRenderer(GridControlBase control, GridCellModelBase model) 
        :base(control,model) 
    { //Code to add image buttons as in the MultipleImageCell.cs 
    } 
    protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleIn 
    { 
        Rectangle rectangle = base.OnLayout(rowIndex, colIndex, style, innerBound 
        int xLoc = 0; 
        for (int i = 0; i < buttonsBounds.Length; i++) 
        { 
            buttonsBounds[i].X += 5 + xLoc; 
            xLoc += 15; 
        } 
        return rectangle; 
    } 
} 
 
//Code in Form1 
//To register the cell model 
this.gridGroupingControl1.TableModel.CellModels.Add("CheckBoxImg", new CheckBoxCellModel(this.gridGroupingControl1.TableModel)); 
 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.CellType = "CheckBoxImg"; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Show; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", false); 
//To render the check box at the topright of the cell. 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Right; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.TextAlign = GridTextAlign.Right; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.Description = "1/0"; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Width = 120; 
 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 29, 2019 07:37 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We have analyzed you query and suspect that you are trying to add the buttons in the order of 3 image, description and checkbox in a cell. This can be achieved by creating a custom CheckBoxCellRenderer and the button bounds can be adjusted to render the buttons. We have created a simple sample to achieve the scenario and please make use of below sample code. 
 
Example code 
 
public class CheckBoxCellRenderer : GridCheckBoxCellRenderer 
{ 
    MultipleImageCell[] mybuttons; 
    public CheckBoxCellRenderer(GridControlBase control, GridCellModelBase model) 
        :base(control,model) 
    { //Code to add image buttons as in the MultipleImageCell.cs 
    } 
    protected override Rectangle OnLayout(int rowIndex, int colIndex, GridStyleIn 
    { 
        Rectangle rectangle = base.OnLayout(rowIndex, colIndex, style, innerBound 
        int xLoc = 0; 
        for (int i = 0; i < buttonsBounds.Length; i++) 
        { 
            buttonsBounds[i].X += 5 + xLoc; 
            xLoc += 15; 
        } 
        return rectangle; 
    } 
} 
 
//Code in Form1 
//To register the cell model 
this.gridGroupingControl1.TableModel.CellModels.Add("CheckBoxImg", new CheckBoxCellModel(this.gridGroupingControl1.TableModel)); 
 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.CellType = "CheckBoxImg"; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.Show; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", false); 
//To render the check box at the topright of the cell. 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.HorizontalAlignment = GridHorizontalAlignment.Right; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.TextAlign = GridTextAlign.Right; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Appearance.AnyRecordFieldCell.Description = "1/0"; 
gridGroupingControl1.TableDescriptor.Columns["Check"].Width = 120; 
 
 
Regards, 
Arulpriya 


Hi Arulpriya

Thank you for your answer
1 how to make a button in Columns ["Check"] work

void gridGroupingControl11_TableControlCellButtonClicked (object sender, GridTableControlCellButtonClickedEventArgs e)
2. can you do like Columns ["Check"] with dateTime 

Columns ["dateTime"]

Regards, 
Gregory




AR Arulpriya Ramalingam Syncfusion Team December 2, 2019 11:41 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We have analyzed the reported use and it occurred due to the currentcell is not updated since it is a CheckBoxCell. Also, the button bounds were updated with different location and width. We have fixed the use cases by adding the ButtonBarSize instead of customizing the width using OnLayout() method. And, the CurrentCell can be moved to check box cell to satisfy the condition check on gridGroupingControl11_TableControlCellButtonClicked event, when the image button mouse down is occurred. Please make use of below code and modified sample. 
 
Code example 
 
ButtonBarSize 
public CheckBoxCellModel(GridModel control) 
    : base(control) 
{ 
    //In constructor of CheckBoxCellModel.cs file 
    ButtonBarSize = new Size(60, 20); 
} 
 
Note: there is no need to implement the OnLayout() customization for CheckBoxCell that was provided in our previous update. 
To updagte currentcell when the cell button clicked 
//Code in MultipleImageCell 
protected override void OnMouseDownChanged(GridCellEventArgs e) 
{ 
    //To update the current cell to show the messagebox. 
    GridCurrentCell currentCell = this.Grid.CurrentCell; 
    if (currentCell.RowIndex != e.RowIndex || currentCell.ColIndex != e.ColIndex) 
        currentCell.MoveTo(e.RowIndex, e.ColIndex); 
    base.OnMouseDownChanged(e); 
} 
 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam December 2, 2019 12:11 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We have analyzed the reported use and it occurred due to the currentcell is not updated since it is a CheckBoxCell. Also, the button bounds were updated with different location and width. We have fixed the use cases by adding the ButtonBarSize instead of customizing the width using OnLayout() method. And, the CurrentCell can be moved to check box cell to satisfy the condition check on gridGroupingControl11_TableControlCellButtonClicked event, when the image button mouse down is occurred. Please make use of below code and modified sample. 
 
Code example 
 
ButtonBarSize 
public CheckBoxCellModel(GridModel control) 
    : base(control) 
{ 
    //In constructor of CheckBoxCellModel.cs file 
    ButtonBarSize = new Size(60, 20); 
} 
 
Note: there is no need to implement the OnLayout() customization for CheckBoxCell that was provided in our previous update. 
To updagte currentcell when the cell button clicked 
//Code in MultipleImageCell 
protected override void OnMouseDownChanged(GridCellEventArgs e) 
{ 
    //To update the current cell to show the messagebox. 
    GridCurrentCell currentCell = this.Grid.CurrentCell; 
    if (currentCell.RowIndex != e.RowIndex || currentCell.ColIndex != e.ColIndex) 
        currentCell.MoveTo(e.RowIndex, e.ColIndex); 
    base.OnMouseDownChanged(e); 
} 
 
 
Regards, 
Arulpriya 


Hi Arulpriya

thank you for the first answer - it works

2. can you do like Columns ["Check"] with dateTime 
Columns ["dateTime"]

- how to model a date column and add buttons, and just as before and for the button to work


Regards,
Gregory

 









AR Arulpriya Ramalingam Syncfusion Team December 2, 2019 01:40 PM UTC

 
Thank you for the update. 
 
We suspect that you are trying the add DateTime values in the CheckBox cell. If yes, the CellType for the column could not be set as DateTime but, the DateTime values can be loaded in the cells for CheckBox column by customizing the QueryCellStyleInfo event using Description property. Please make use of the below code and modified sample. 
 
Code example 
 
//Event subscription 
gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 
 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if(e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.Name == "Check") 
    { 
        //To set the datetime value for CheckBox column 
        e.Style.Description = DateTime.Now.AddDays(e.TableCellIdentity.RowIndex).ToShortDateString(); 
        e.Handled = true; 
    } 
} 
 
 
Note: If you need to open a DropDown with DateTimePicker control, this can be achieved by overriding the DropDownContainerShowingDropDown method and customize it as in the CalculatorCellRenderer. 
 
If we misunderstood your scenario, please get back to us with simple screenshot. 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam December 2, 2019 04:29 PM UTC

 
Thank you for the update. 
 
We suspect that you are trying the add DateTime values in the CheckBox cell. If yes, the CellType for the column could not be set as DateTime but, the DateTime values can be loaded in the cells for CheckBox column by customizing the QueryCellStyleInfo event using Description property. Please make use of the below code and modified sample. 
 
Code example 
 
//Event subscription 
gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo; 
 
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if(e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.Name == "Check") 
    { 
        //To set the datetime value for CheckBox column 
        e.Style.Description = DateTime.Now.AddDays(e.TableCellIdentity.RowIndex).ToShortDateString(); 
        e.Handled = true; 
    } 
} 
 
 
Note: If you need to open a DropDown with DateTimePicker control, this can be achieved by overriding the DropDownContainerShowingDropDown method and customize it as in the CalculatorCellRenderer. 
 
If we misunderstood your scenario, please get back to us with simple screenshot. 
 
Regards, 
Arulpriya 


Hi Arulpriya
Thank you for the update.

I meant changing the data type in the column
 myDataColumn.ColumnName = "B_dateTime";  //("System.DateTime")
I meant changing the data type in the column "B_dateTime"
and add buttons in this field




Regards
Gregory

Attachment: CheckBox_f945a6b6.rar


AR Arulpriya Ramalingam Syncfusion Team December 3, 2019 03:18 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
DateTime dropdown can be added by implementing the DropDownContainerShowingDropDown to add a calender in the drop down. We have modified the sample as per your requirement. Please make use of the below code and sample. 
 
Code example 
 
private void Calendar_DateChanged(object sender, EventArgs e) 
{ 
    string rowColIndex = RowIndex + ":" + ColIndex; 
    if(description.ContainsKey(rowColIndex)) 
    { 
        description[rowColIndex] = calendar.Value.ToShortDateString(); 
    } 
    else 
    { 
        description.Add(rowColIndex, calendar.Value.ToShortDateString()); 
    } 
    DropDownContainer.HidePopup(Syncfusion.Windows.Forms.PopupCloseType.Done); 
    this.Grid.InvalidateRange(GridRangeInfo.Cell(RowIndex, ColIndex)); 
} 
 
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style) 
{ 
    string index = rowIndex + ":" + colIndex; 
    string text = style.Text; 
    if (description.ContainsKey(index)) 
        text = description[index]; 
    style.Description = text; 
    base.OnDraw(g, clientRectangle, rowIndex, colIndex, style); 
} 
 
MonthCalendarAdv calendar; 
public override void DropDownContainerShowingDropDown(object sender, CancelEventArgs e) 
{ 
    (this.DropDownContainer as GridDropDownContainer).Size = calendar.Size; 
    base.DropDownContainerShowingDropDown(sender, e); 
} 
 
 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam December 3, 2019 07:30 PM UTC

Hi Gregory, 
 
Thank you for the update. 
 
DateTime dropdown can be added by implementing the DropDownContainerShowingDropDown to add a calender in the drop down. We have modified the sample as per your requirement. Please make use of the below code and sample. 
 
Code example 
 
private void Calendar_DateChanged(object sender, EventArgs e) 
{ 
    string rowColIndex = RowIndex + ":" + ColIndex; 
    if(description.ContainsKey(rowColIndex)) 
    { 
        description[rowColIndex] = calendar.Value.ToShortDateString(); 
    } 
    else 
    { 
        description.Add(rowColIndex, calendar.Value.ToShortDateString()); 
    } 
    DropDownContainer.HidePopup(Syncfusion.Windows.Forms.PopupCloseType.Done); 
    this.Grid.InvalidateRange(GridRangeInfo.Cell(RowIndex, ColIndex)); 
} 
 
protected override void OnDraw(Graphics g, Rectangle clientRectangle, int rowIndex, int colIndex, GridStyleInfo style) 
{ 
    string index = rowIndex + ":" + colIndex; 
    string text = style.Text; 
    if (description.ContainsKey(index)) 
        text = description[index]; 
    style.Description = text; 
    base.OnDraw(g, clientRectangle, rowIndex, colIndex, style); 
} 
 
MonthCalendarAdv calendar; 
public override void DropDownContainerShowingDropDown(object sender, CancelEventArgs e) 
{ 
    (this.DropDownContainer as GridDropDownContainer).Size = calendar.Size; 
    base.DropDownContainerShowingDropDown(sender, e); 
} 
 
 
Arulpriya 


Hi Arulpriya

how to add Multiple Image button to Table Descriptor.Columns ["B dateTime"] column
after pressing button4_Click

MultipleImage in B_dateTime
 private void button4_Click(object sender, EventArgs e)
        {
            this.gridGroupingControl1.TableDescriptor.Columns["B_dateTime"].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.MonthCalendar;
            this.gridGroupingControl1.TableDescriptor.Columns["B_dateTime"].Appearance.AnyRecordFieldCell.Format = "dd/MM/yyyy";
            this.gridGroupingControl1.TableDescriptor.Columns["B_dateTime"].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.ShowCurrentCellEditing;
        }




Regards
Gregory

Attachment: MultipleImage_with_datetime_af0cac2c.rar


AR Arulpriya Ramalingam Syncfusion Team December 4, 2019 07:42 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
A custom cell model from the GridDropDownMonthCalendarCellModel can be customized to add image buttons in the MonthCalendar cell. ButtonBarSize can be used to set the buttons width and align the button at the right side of the cell. We have modified the sample as per your requirement and please make use of the below code. 
 
Example code 
 
public class MonthCalendarButtonCell : GridDropDownMonthCalendarCellModel 
{ 
    public MonthCalendarButtonCell(GridModel grid)  
        :base(grid) 
    { 
        ButtonBarSize = new Size(60, 20); 
    } 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new MonthCalendarButtonCellRenderer(control,this); 
    } 
} 
public class MonthCalendarButtonCellRenderer : GridDropDownMonthCalendarCellRenderer 
{ 
    MultipleImageCell[] mybuttons; 
    public MonthCalendarButtonCellRenderer(GridControlBase grid, GridCellModelBase cellModel 
        : base(grid, cellModel) 
    { 
        Image image1 = Image.FromFile(@"..\\..\\delete.png"); 
        Image image2 = Image.FromFile(@"..\\..\\basic.png"); 
        Image image3 = Image.FromFile(@"..\\..\\disk_blue.png"); 
        mybuttons = new MultipleImageCell[3]; 
        mybuttons[0] = new MultipleImageCell(this, image1); 
        mybuttons[0].Text = "Image1"; 
        mybuttons[1] = new MultipleImageCell(this, image2); 
        mybuttons[1].Text = "Image2"; 
        mybuttons[2] = new MultipleImageCell(this, image3); 
        mybuttons[2].Text = "Image3"; 
        AddButton(mybuttons[0]); 
        AddButton(mybuttons[1]); 
        AddButton(mybuttons[2]); 
    } 
} 
 
 
Please get back to us with simple screenshot, if we misunderstood the scenario. 
 
Note: The buttons in an existing cell type can be added by creating a custom cell model from the corresponding GridCellModels. Please refer to the below class reference for existing cell models. 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam December 4, 2019 08:30 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
A custom cell model from the GridDropDownMonthCalendarCellModel can be customized to add image buttons in the MonthCalendar cell. ButtonBarSize can be used to set the buttons width and align the button at the right side of the cell. We have modified the sample as per your requirement and please make use of the below code. 
 
Example code 
 
public class MonthCalendarButtonCell : GridDropDownMonthCalendarCellModel 
{ 
    public MonthCalendarButtonCell(GridModel grid)  
        :base(grid) 
    { 
        ButtonBarSize = new Size(60, 20); 
    } 
    public override GridCellRendererBase CreateRenderer(GridControlBase control) 
    { 
        return new MonthCalendarButtonCellRenderer(control,this); 
    } 
} 
public class MonthCalendarButtonCellRenderer : GridDropDownMonthCalendarCellRenderer 
{ 
    MultipleImageCell[] mybuttons; 
    public MonthCalendarButtonCellRenderer(GridControlBase grid, GridCellModelBase cellModel 
        : base(grid, cellModel) 
    { 
        Image image1 = Image.FromFile(@"..\\..\\delete.png"); 
        Image image2 = Image.FromFile(@"..\\..\\basic.png"); 
        Image image3 = Image.FromFile(@"..\\..\\disk_blue.png"); 
        mybuttons = new MultipleImageCell[3]; 
        mybuttons[0] = new MultipleImageCell(this, image1); 
        mybuttons[0].Text = "Image1"; 
        mybuttons[1] = new MultipleImageCell(this, image2); 
        mybuttons[1].Text = "Image2"; 
        mybuttons[2] = new MultipleImageCell(this, image3); 
        mybuttons[2].Text = "Image3"; 
        AddButton(mybuttons[0]); 
        AddButton(mybuttons[1]); 
        AddButton(mybuttons[2]); 
    } 
} 
 
 
Please get back to us with simple screenshot, if we misunderstood the scenario. 
 
Note: The buttons in an existing cell type can be added by creating a custom cell model from the corresponding GridCellModels. Please refer to the below class reference for existing cell models. 
 
Regards, 
Arulpriya 


Hi Arulpriya
works - thank you for professionalism and patience

Regards
Gregory


AR Arulpriya Ramalingam Syncfusion Team December 4, 2019 08:41 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We are glad that the reported use cases are resolved from the provided solution. Please get back to us, if you need any further assistance. 
 
Regards, 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam December 4, 2019 09:07 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
We are glad that the reported use cases are resolved from the provided solution. Please get back to us, if you need any further assistance. 
 
Regards, 
Arulpriya 


Hi
is there any way to if I type in Columns ["B_dateTime"]
I enter "+15" then it will not validate for me as an error but it will correct and insert DateTime. Now + 15 days

Regards
Gregory


AR Arulpriya Ramalingam Syncfusion Team December 5, 2019 07:06 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
By default, the cell value will be validated based on the CellValueType and DateTime.TryParse will return true for the value of date with addition (11/12/2019 + 12) which is the behavior of MSDN datetime parsing. In order to restrict this behavior, the custom validation for the cells can be added by using the TableControlCurrentCellValidating event. We have modified the sample based on your requirement and please make use of it. 
 
Example code 
 
//Event triggering 
gridGroupingControl1.TableControlCurrentCellValidating += GridGroupingControl1_TableControlCurrentCellValidating; 
 
//Event subscription 
private void GridGroupingControl1_TableControlCurrentCellValidating(object sender, GridTableControlCancelEventArgs e) 
{ 
    using (GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex)) 
    { 
        if (style.TableCellIdentity.Column != null && style.TableCellIdentity.Column.Name == "B_dateTime") 
        { 
            MonthCalendarButtonCellRenderer ren = e.TableControl.CurrentCell.Renderer as MonthCalendarButtonCellRenderer; 
            //Can be customized for the use cases that to be checked. 
            if (ren.ControlText.Contains("+")) 
            { 
                e.Inner.Cancel = true; 
                e.TableControl.CurrentCell.Exception = new Exception("Enter valid value"); 
            } 
        } 
    } 
} 
 
 
 
Arulpriya 


Loader.
Up arrow icon