We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

sample Data Relations 1.4.3.2.12.1 Nested Drop-down Grids

Thread ID:

Created:

Updated:

Platform:

Replies:

120549 Sep 24,2015 08:05 PM UTC Jun 15,2017 05:13 PM UTC WinForms 29
loading
Tags: GridDataBoundGrid(Classic)
Gregory Pe
Asked On September 24, 2015 08:05 PM UTC

How to make
sample Data Relations 1.4.3.2.12.1 Nested Drop-down Grids

in
   private void button6_Click(object sender, EventArgs e)
        {
           //How to make
           //sample Data Relations 1.4.3.2.12.1 Nested Drop-down Grids
//Order_Details_gridDataBoundGrid1 new
        }


 test009DataSet.Order

parent table = test009DataSet.Order_Details  //Order_Details_gridDataBoundGrid1 new

if Order_Details.feature0 = 1   
Child table.= this.feature01TableAdapter.Fill(this.test009DataSet.feature01);
+ Child table.=  this.feature01DDTableAdapter.Fill(this.test009DataSet.feature01DD);


if Order_Details.feature0 = 2   
Child table. = this.feature02TableAdapter.Fill(this.test009DataSet.feature02);
+ Child table.=  this.feature02DDTableAdapter.Fill(this.test009DataSet.feature02DD);

if feature0 = 0   empty

Form.Net button3 in Form4 is sample work

please help



and connect to Order_Details_gridDataBoundGrid1  : contextMenuStripEx1









Attachment: test5_f6ffd941.zip

Adhikesevan Kothandaraman [Syncfusion]
Replied On September 25, 2015 06:08 PM UTC

Hi Grzegorz,

Thanks for contacting Syncfusion Support.

We are unclear with your query. We need some clarification from your post. Can you please brief what you are mentioned for the term 1.4.3.2.12.1 NestedDropDown grid? It will be helpful for us to provide the solution at the earliest.

Regards,
Adhi

Gregory Pe
Replied On September 25, 2015 07:28 PM UTC

Hi Grzegorz,

Thanks for contacting Syncfusion Support.

We are unclear with your query. We need some clarification from your post. Can you please brief what you are mentioned for the term 1.4.3.2.12.1 NestedDropDown grid? It will be helpful for us to provide the solution at the earliest.

Regards,
Adhi

term 1.4.3.2.12.1 NestedDropDown grid? - it is sample in  pdf Essential Grid for Windows Forms P a g e  : 9 8 4

I mean like the presentation of data


Adhikesevan Kothandaraman [Syncfusion]
Replied On September 28, 2015 12:51 PM UTC

Hi Grzegorz,

Thanks for your update.

To have the nested grid(hierarchical data) in a GridDataBoundGrid, add the dataset with the relations and set the dataset as the data source. Please refer to the following code example,
 
Code Snippet:

DataTable parentTable = GetParentTable();

DataTable childTable = GetChildTable();

DataTable grandChildTable = GetGrandChildTable();

DataTable greatGrandChildTable = GetGreatGrandChildTable();

DataTable greatGreatGrandChildTable = GetGreatGreatGrandChildTable();


DataSet ds=new DataSet();

ds.Tables.AddRange(new DataTable[] {parentTable,childTable,grandChildTable,greatGrandChildTable,greatGreatGrandChildTable});


ds.Relations.Add(new DataRelation("ParentToChild", ds.Tables[0].Columns["parentID"], ds.Tables[1].Columns["ParentID"]));

ds.Relations.Add(new DataRelation("ChildToGrandChild", ds.Tables[1].Columns["childID"], ds.Tables[2].Columns["ChildID"]));

ds.Relations.Add(new DataRelation("GrandChildToGreatGrandChild", ds.Tables[2].Columns["grandChildID"], ds.Tables[3].Columns["GrandChildID"]));

ds.Relations.Add(new DataRelation("GreatGrandChildToGreatGreatGrandChild", ds.Tables[3].Columns["greatGrandChildID"], ds.Tables[4].Columns["GreatGrandChildID"]));


this.gridDataBoundGrid1.DataSource=ds;

Please refer to the following dashboard sample, it shows how to add the nested grid in GridDataBoundGrid.
Dashboard sample:
<InstalledLocation>\Syncfusion\EssentialStudio\<VersionNo>\Windows\GridDataBound.Windows\Samples\ Hierarchy\GDBG Tree Lines Demo\CS

Regards,
Adhi


Gregory Pe
Replied On September 29, 2015 04:40 PM UTC

Hi Adhi
does not work 

 DataTable parentTable = this.test009DataSet.Order_Details;// GetParentTable();

there is no relationship

if Order_Details.feature0 == 1   //if true
 DataTable childTable = this.test009DataSet.feature01; //GetChildTable();
            DataTable grandChildTable = this.test009DataSet.feature01DD;//  GetGrandChildTable();

if Order_Details.feature0 == 2   
 DataTable childTable = this.test009DataSet.feature02; //GetChildTable();
            DataTable grandChildTable = this.test009DataSet.feature02DD;//  GetGrandChildTable();


if feature0 == 0 
 empty

change the table childTable and grandChildTable is governed by the this.test009DataSet.Order_Details.feature0Column (0 or 1 or 2)


in  button3 in Form4 is sample work  Form.Net

Anish George [Syncfusion]
Replied On October 5, 2015 04:06 AM UTC

Hi Chariat,
 
Thank you for your patience.
 
We request you to create an DirecTrac incident regarding this so that our development team can work on this query and can give you  a proper solution.

Please let us know if you need any further assistance.

Regards,
Anish.

Gregory Pe
Replied On October 5, 2015 06:50 AM UTC

Creating a Calculated Column in the GridDataBoundGrid Control

I have a GridDataBoundGrid in which I want to "*" up values from two different columns into a third column.
Example DataGridView:
Quantity   UnitPrice   value
2.00   2.00    4.00
3.00  2.00   6.00
5.00   2.00   10.00
I want to add (Quantity  * UnitPrice in value),
 just after entering values in Quantity & UnitPrice column or leaving current row.
.
whether this method is correct -
whether it is recommended :  
void Grid_CurrentCellChanging(object sender, CancelEventArgs e)     
          {
            int nField001 = this.order_DetailsGridDataBoundGrid.Binder.NameToField("Quantity");
            int nField002 = this.order_DetailsGridDataBoundGrid.Binder.NameToField("UnitPrice");
            if (this.order_DetailsGridDataBoundGrid.CurrentCell.ColIndex == nField001 + 1 | this.order_DetailsGridDataBoundGrid.CurrentCell.ColIndex == nField002 + 1)
            {
                try
                {
                    int nField008 = this.order_DetailsGridDataBoundGrid.Binder.NameToField("ProductID");
                    int nField003 = this.order_DetailsGridDataBoundGrid.Binder.NameToField("value");
                    decimal unitPrice = Convert.ToDecimal(this.order_DetailsGridDataBoundGrid[this.order_DetailsGridDataBoundGrid.CurrentCell.RowIndex, nField002 + 1].Text );
                    decimal quantity = Convert.ToDecimal(this.order_DetailsGridDataBoundGrid[this.order_DetailsGridDataBoundGrid.CurrentCell.RowIndex, nField001 + 1].Text);
                    decimal value_1 = unitPrice * quantity;
                    this.order_DetailsGridDataBoundGrid[this.order_DetailsGridDataBoundGrid.CurrentCell.RowIndex, nField003 + 1].Text = "" + value_1 + "";
                }
                catch (Exception)
                {
                    ;
                }
            }
count me before the change . after the change should

Regards,


Solai A L [Syncfusion]
Replied On October 6, 2015 01:13 PM UTC

Hi Chariat,

We have prepared simple sample using PrepareViewStyleInfo event to multiply and add the values in third column. Please refer the below provided sample . And also could you please clarify us what do you mean by “count me before the change . after the change should”.

Code :

void gridDataBoundGrid1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)

        {

            CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGrid1.DataSource];


            if (e.ColIndex == 5 && e.RowIndex > 0 && e.RowIndex<this.gridDataBoundGrid1.Model.RowCount)

            {

                e.Style.CellValue = (Convert.ToDouble(((DataView)cm.List).Table.Rows[this.gridDataBoundGrid1.Binder.RowIndexToPosition(e.RowIndex)]["Quantity"]) * Convert.ToDouble(((DataView)cm.List).Table.Rows[this.gridDataBoundGrid1.Binder.RowIndexToPosition(e.RowIndex)]["Price"])).ToString();


            }

        }

Sample :
http://www.syncfusion.com/downloads/support/forum/120549/ze/Combobox_modified-1920434460

Thanks & Regards,
AL.Solai.


Gregory Pe
Replied On November 16, 2015 11:10 AM UTC

Hi. AL.Solai
Thank you for your response

but I have a problem with the update when
TextChanged in "Quantity" or "UnitPrice"

when you press the Tab does not enumerate "value"

and

"value"does not show format - .NameToField("Quantity")].StyleInfo.Format = "N2"

when used  contextMenuStripEx1 - insert - shows an error

copy and delete does not work

please help

Regards,






Attachment: s_test2_8d335168.zip

Solai A L [Syncfusion]
Replied On November 17, 2015 12:45 PM UTC

Hi Grzegorz,

Thank you for your update.

Value column is not updated based on Quantity / Price

The Value Column is getting updated properly based on the value of Quantity and Price in current version 13.3. Please let us know the version that your using

Format is not applied

.NameToField("Quantity")].StyleInfo.Format = "N2"

Please refer the below image. The format is applied properly with the current version 13.3



Insert/Delete and Copy is not working

When your inserting a empty new record, it stores it as  DBNull values which means that value does not exists. And for deleting a record, use RemoveRecords() from binder. Since, you have used insert method inside copy, the same DBNULL issue exist there also.

Please try the below modified code example  for insert/delete and copy.


Code Example :

private void insertToolStripMenuItem_Click(object sender, EventArgs e)

        {


            GridCurrentCell cc = this.order_DetailsGridDataBoundGrid.CurrentCell;

            DataRow tableRow1 = this.test009DataSet.Order_Details.NewRow();

            tableRow1["OrderID"] = 10002;

            tableRow1["ProductID"] = "9";

            tableRow1["UnitPrice"] = "9";

            tableRow1["value"] = 2.44;

            tableRow1["Quantity"] = 5;

                this.test009DataSet.Order_Details.Rows.InsertAt(tableRow1, cc.RowIndex);

           // this.test009DataSet.Order_Details.AcceptChanges();

            this.order_DetailsGridDataBoundGrid.Refresh();

            this.order_DetailsGridDataBoundGrid.CurrentCell.MoveTo(cc.RowIndex, 0);

        }


        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)

        {

            GridCurrentCell cc = this.order_DetailsGridDataBoundGrid.CurrentCell;

            //http://help.syncfusion.com/windowsforms/gridgrouping/delete-collection-of-records-in-gridgroupingcontrol

            //we are subtracting one since, the record count will start from zero.

            this.order_DetailsGridDataBoundGrid.Binder.RemoveRecords(cc.RowIndex-1,cc.RowIndex-1);

        }


        private void copyToolStripMenuItem_Click(object sender, EventArgs e)

        {

            GridCurrentCell cc = this.order_DetailsGridDataBoundGrid.CurrentCell;


            this.order_DetailsGridDataBoundGrid.Model.CutPaste.Copy();

            insertToolStripMenuItem_Click(sender, e);

            this.order_DetailsGridDataBoundGrid.CurrentCell.MoveTo(cc.RowIndex, cc.ColIndex);

            this.order_DetailsGridDataBoundGrid.Model.CutPaste.Paste();


        }

Modified sample :

http://www.syncfusion.com/downloads/support/forum/120549/ze/s_test21287255336





Thanks,
A
L.Solai.


Gregory Pe
Replied On November 17, 2015 07:24 PM UTC

Hi. AL.Solai

my version   13.3450.0.12  -13.3.012

example does not work properly
column "value" is not updated based on Quantity / Price -  
when you press the Tab does not enumerate "value"
-
if you clicked on the next line it works

"value"- 
does not hold a defined format  --
 this.order_DetailsGridDataBoundGrid.Binder.InternalColumns[this.order_DetailsGridDataBoundGrid.Binder.NameToField("value")].StyleInfo.Format = "C";


when used  contextMenuStripEx1
- insert, delete  -
works properly- ok

but copying is not


Or is there some other way for this functionality

please help










Solai A L [Syncfusion]
Replied On November 18, 2015 01:19 PM UTC

Hi Grzegorz,


Thank you for your update.


1. column "value" is not updated based on Quantity / Price -   when you press the Tab does not enumerate "value" 
-
 if you clicked on the next line it works
Please use the DirectSaveCellInfo to save cell values directly into the datasource without moving the current record and without calling BeginEdit or EndEdit.
Code Example :
this.order_DetailsGridDataBoundGrid.Binder.DirectSaveCellInfo = true;
2. "value"-  does not hold a defined format  --
 this.order_DetailsGridDataBoundGrid.Binder.InternalColumns[this.order_DetailsGridDataBoundGrid.Binder.NameToField("value")].StyleInfo.Format = "C";

You have assigned String Value in PrepareViewStyleInfo. Please modify the code as show below.
Code Example :
e.Style.Format = "C";
 e.Style.CellValue = (Convert.ToDecimal(((DataView)cm.List).Table.Rows[this.order_DetailsGridDataBoundGrid.Binder.RowIndexToPosition(e.RowIndex)]["Quantity"]) * Convert.ToDecimal(((DataView)cm.List).Table.Rows[this.order_DetailsGridDataBoundGrid.Binder.RowIndexToPosition(e.RowIndex)]["UnitPrice"]));


3. Please refer the below code to copy the range of cells to clipboard.
Code Example :


//To copy selected range of cells to clipboard in GridDataBoundGrid.
bool val = this.gridDataBoundGrid1.Model.CutPaste.CopyTextToClipboard(this.gridDataBoundGrid1.Selections.Ranges);
Reference Link :
https://www.syncfusion.com/kb/3955/how-to-copy-the-selected-range-of-cells-to-the-clipboard




Thanks,
AL.Solai.

Gregory Pe
Replied On November 18, 2015 06:16 PM UTC

Hi. AL.Solai
1.  ok
2. "value"-  does not hold a defined format  --
e.Style.Format = "C";   
 e.Style.CellValue = (Convert.ToDecimal(((DataView)cm.List).Table.Rows[this.order_DetailsGridDataBoundGrid.Binder.RowIndexToPosition(e.RowIndex)]["Quantity"]) * Convert.ToDecimal(((DataView)cm.List).Table.Rows[this.order_DetailsGridDataBoundGrid.Binder.RowIndexToPosition(e.RowIndex)]["UnitPrice"]));

 example does not work properly   -

3.
Code Example
needs a copy - duplicate the contents of the selected row
//copy
move - insert a blank line
paste - the contents of the selected row


private void copyToolStripMenuItem_Click(object sender, EventArgs e)

        {

            GridCurrentCell cc = this.order_DetailsGridDataBoundGrid.CurrentCell;


            this.order_DetailsGridDataBoundGrid.Model.CutPaste.Copy();

            insertToolStripMenuItem_Click(sender, e);

            this.order_DetailsGridDataBoundGrid.CurrentCell.MoveTo(cc.RowIndex, cc.ColIndex);

            this.order_DetailsGridDataBoundGrid.Model.CutPaste.Paste();


        }

http://www.syncfusion.com/downloads/support/forum/120549/ze/s_test21287255336



4.  additionally  -  how to save the base -
 
  private void button1_Click(object sender, EventArgs e)
        {
                  this.order_DetailsTableAdapter.Update(this.test009DataSet);
        }

---does not save the new calculations "value"



please help




Anish George [Syncfusion]
Replied On November 20, 2015 09:28 AM UTC

Hi  Grzegorz,

Thank you for your update.

Query
Response
"value"-  does not hold a defined format  --
 example does not work properly 
We have modified the sample so that it achieves your requested scenario. Please refer the below sample.
needs a copy - duplicate the contents of the selected row
//copy
move - insert a blank line
paste - the contents of the selected row
The contents are not pasting because the current cell is not moving to the next row while pasting and also the selection row has to be changed while pasting. Please make use of the below code while copying.

GridCurrentCell cc = this.order_DetailsGridDataBoundGrid.CurrentCell;


this.order_DetailsGridDataBoundGrid.Model.CutPaste.Copy();

insertToolStripMenuItem_Click(sender, e);

this.order_DetailsGridDataBoundGrid.Selections.Clear();

this.order_DetailsGridDataBoundGrid.CurrentCell.MoveTo(cc.RowIndex + 1, cc.ColIndex);

this.order_DetailsGridDataBoundGrid.Selections.Add(GridRangeInfo.Row(cc.RowIndex));
this.order_DetailsGridDataBoundGrid.Model.CutPaste.Paste();

Also have added this code in the below sample please check it for your reference.

additionally  -  how to save the base -
You have to use the AcceptChanges()  method before updating the table. Please refer the below code.


this.test009DataSet.AcceptChanges();
this.tableAdapterManager.UpdateAll(this.test009DataSet);

We have added this code in the below sample please check it for your reference.


Sample:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/s_test2-1614462369.zip            

Please let us know if you need any further assistance.

Regards,
Anish.

Gregory Pe
Replied On November 23, 2015 05:11 PM UTC

Hi. AL.Solai


additionally  -  how to save the base -  example does not work properly

  private void button2_Click(object sender, EventArgs e)  //save
        {
            this.test009DataSet.AcceptChanges();
            this.tableAdapterManager.UpdateAll(this.test009DataSet);
        }


I tried  ------    but it does not save "value"
  private void button1_Click(object sender, EventArgs e) //save 2
        {
            this.Validate();
            this.order_DetailsBindingSource.EndEdit();
            this.order_DetailsTableAdapter.Update(this.test009DataSet);
        }


I checked
    private void button3_Click(object sender, EventArgs e) //check - save
        {
            Form2 settingsForm = new Form2();
            settingsForm.Show();
        }


please help





Attachment: c_test2c_f072c90.zip

Solai A L [Syncfusion]
Replied On November 24, 2015 05:48 AM UTC

Hi Grzegorz,

Thank you for your update.

Save operation works fine on using the below code. Please refer the below video for reference. AcceptChanges() would update the value in DB and UpdateAll() would update the value in grid.
Code :
this.test009DataSet.AcceptChanges();
this.tableAdapterManager.UpdateAll(this.test009DataSet);

Video :
http://www.syncfusion.com/downloads/support/forum/120549/ze/save1946558725

Thanks,
Al.Solai.

Gregory Pe
Replied On November 24, 2015 05:35 PM UTC

Hi. AL.Solai

Video is ok


but why not write to the database
when I check // check - save Form2
I see the empty "value" in order_DetailsDataGridView

please help

Solai A L [Syncfusion]
Replied On November 25, 2015 12:26 PM UTC

Hi Grzegorz,

Thank you for your update.


For your scenario, the GridDataBound control won’t be an appropriate control. Refer to the following KB.

Reference kb :
https://www.syncfusion.com/kb/4654/How-to-choose-the-best-grid

So, we used the same data with 
gridgrouping control in form2 and showed you how to fetch the modified values of “value” column. And for Value column instead of populating the values using QueryCellInfo we have used ExpressionFileds which makes your work easier. Please refer to the following code example and modified sample.


Code Example :

// Add expression field descriptor values at the end of the Expression Fields

this.gridGroupingControl1.TableDescriptor.ExpressionFields.AddRange(newSyncfusion.Grouping.ExpressionFieldDescriptor[] {
new Syncfusion.Grouping.ExpressionFieldDescriptor("Result", "([Quantity] *[UnitPrice])", "System.Double")});

void gridGroupingControl1_TableControlCurrentCellAcceptedChanges(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)

        {

            GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);

            GridTableCellStyleInfoIdentity id = style.TableCellIdentity;

            Record rec = id.DisplayElement.GetRecord();

            //modified value of value column

            string modifiedvalue = rec.GetValue("Result").ToString();

        }
Sample :
http://www.syncfusion.com/downloads/support/forum/120549/ze/s_test2-404028939


Regards,

AL.Solai.



Gregory Pe
Replied On November 25, 2015 06:38 PM UTC

Hi. AL.Solai

gridGroupingControl -
I checked but the problem is still

1.
 when I check // check - save Form2
I see the empty "value" in order_DetailsDataGridView

It needs to ensure that "value" was written to the database

2.
additionally not working properly:
insert and copy -contextMenuStripEx1 -
  in gridDataBoundGrid it worked perfectly

3.
adding a new line at the end of the table, as it was in gridDataBoundGrid

4.
how to add the format for the
("value")]. StyleInfo.Format = "C"
("Quantity")]. StyleInfo.Format = "N2"
("UnitPrice")]. StyleInfo.Format = "C"


please help



Attachment: s_test2f_7037f89c.zip

Solai A L [Syncfusion]
Replied On November 26, 2015 07:34 AM UTC

Hi Gregorz,


Thank you for your update. 


To save the value to DB
Expression field column is similar to unbound column. If you want to save this value to Db, you need to externally save it. You can get the Result column value in below two possible ways.
1.    Using DrawCellDisplayText

Code :

void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)

        {

            

                e.Inner.DisplayText;

          

        }

2.     Using Style(this can be obtained using any events like current cell edit ,etc..)

Code :

 GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.TableControl.CurrentCell.RowIndex, e.TableControl.CurrentCell.ColIndex);

            GridTableCellStyleInfoIdentity id = style.TableCellIdentity;

            Record rec = id.DisplayElement.GetRecord();

            //modified value of value column

            string modifiedvalue = rec.GetValue("Result").ToString();


Insert and Copy
For insert you should use ForceImmediateSaveCellInfo in GGC similar to DirectSaveCellInfo
Code Example :

//Forces the GridGroupingControl to save the edited values while leaving the CurrentCell.

            foreach (FieldDescriptor col in this.gridGroupingControl1.TableDescriptor.Fields)
                this.gridGroupingControl1.TableDescriptor.Fields[col.Name].ForceImmediateSaveValue = true;

For copying please refer this KB

https://www.syncfusion.com/kb/727/how-to-copy-and-paste-the-nested-table-records-from-the-gridgroupingcontrol-to-excel

Formats
Please refer the below code example for reference.
Code Example :

this.gridGroupingControl1.TableDescriptor.Columns["Quantity"].Appearance.AnyRecordFieldCell.Format = "N2";

            this.gridGroupingControl1.TableDescriptor.Columns["UnitPrice"].Appearance.AnyRecordFieldCell.Format = "C";
            this.gridGroupingControl1.TableDescriptor.Columns["Result"].Appearance.AnyRecordFieldCell.Format = "C";

Note : All the code of gridgrouping control is similar to databoundgrid. But the naming’s may differ slightly.

Thanks,
AL.Solai.



Gregory Pe
Replied On November 26, 2015 08:06 PM UTC

Hi. AL.Solai

1. ok

2.

-contextMenuStripEx1 -

needs a copy - duplicate the contents of the selected row
//copy
move - insert a blank line
paste - the contents of the selected row

insert ,delete -
working properly:

copy -  in gridDataBoundGrid it -
It creates a new record but does not transfer values

3.
adding a new (*) line at the end of the table, as it was in gridDataBoundGrid

4. ok

please help

Attachment: s_test2f_(2)_e8de933f.zip

Solai A L [Syncfusion]
Replied On November 27, 2015 12:10 PM UTC

Hi Grzegorz

Thank you for your update.


adding a new (*) line at the end of the table, 

  Please use the below code to add the addnewrow at the bottom.

Code Example :

this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
            this.gridGroupingControl1.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = true;

Copy and Paste
Please include the below code for copy paste functionality

this.gridGroupingControl1.TableModel.ClipboardCopy += new GridCutPasteEventHandler(TableModel_ClipboardCopy);

            this.gridGroupingControl1.TableModel.ClipboardCut += new GridCutPasteEventHandler(TableModel_ClipboardCut);


void TableModel_ClipboardCut(object sender, GridCutPasteEventArgs e)

        {

            this.gridGroupingControl1.TableControl.Model.CutPaste.Paste();

        }


        void TableModel_ClipboardCopy(object sender, GridCutPasteEventArgs e)

        {

            this.gridGroupingControl1.TableControl.Model.CutPaste.Copy();

        }




Regards,
AL.Solai.



Gregory Pe
Replied On November 30, 2015 08:50 AM UTC

Hi. AL.Solai
3. ok

2. -contextMenuStripEx1 -  Copy and Paste -error
An unhandled exception of type 'System.StackOverflowException' occurred in s_test2f.exe


please help


Attachment: s_test2f_(3)_2c44400a.zip

Christopher Issac Sunder K [Syncfusion]
Replied On December 3, 2015 09:01 PM UTC

Hi Grzegorz,

We regret for the inconvenience.

The stackoverflow exception is because of the recursive call of the copy operation. I have removed that code and commented those ‘ClipboardCopy’ and paste events. I have assumed that your requirement is to copy the whole current row and paste it into the next row. To achieve this, you can add the selection to the current row before the copy operation and no copy/paste events needed for this. The below code is written in the ‘copy’ menu item click,

private void copyToolStripMenuItem_Click(object sender, EventArgs e)

{

          

   <code>

   GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

   this.gridGroupingControl1.TableControl.Selections.Add(GridRangeInfo.Row(cc.RowIndex)); //add selection to the full row.

   this.gridGroupingControl1.TableControl.Model.CutPaste.Copy();

   <code>

}

Here is the modified sample,
s_test2f


Please let me know if I misunderstood your query.

Regards,
Christo


Gregory Pe
Replied On December 4, 2015 02:02 PM UTC


Hi Christo
much better

but:
1.  save 2 - button1 - error "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."
2.  when used-  FieldChooser fchooser = new FieldChooser(this.gridGroupingControl1)
e.g
column "account"  visibility set false
I press copyToolStripMenuItem_Click
next  set column "account"  visibility set true
column "account"  visibility set true
check - then do not copy column "account"

3.  this.gridGroupingControl1.TableDescriptor.Columns["Discount"].ReadOnly = true;
- then do not copy  columns "Discount"

please help


Attachment: s_test2f_(4)_7ebdf5fd.zip

Anish George [Syncfusion]
Replied On December 7, 2015 12:44 PM UTC

Hi Grzegorz,

Thank you for your update.

Query
Response
save 2 - button1 - error "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."
We regret to let you know that we are unable to reproduce the reported issue. We tried to click the save button and no exception has been thrown. Could you please let us know whether we are missing something?
when used-  FieldChooser fchooser = new FieldChooser(this.gridGroupingControl1)
check - then do not copy column "account"
This is the default behavior of copy paste functionality because only the visible contents can be copied and the hidden value will not be copied. So while unhiding the columns only the empty value will be displayed.
this.gridGroupingControl1.TableDescriptor. Columns["Discount"].ReadOnly = true;
- then do not copy  columns "Discount"
We request you to make the ReadOnly property for the column “Discount” to false while copying the row and then again set the property to false to achieve this scenario. Please refer the below code.

C#:

this.gridGroupingControl1.TableDescriptor.Columns["Discount"].ReadOnly = false;


GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;

this.gridGroupingControl1.TableControl.Selections.Add(GridRangeInfo.Row(cc.RowIndex)); //add selection to the full row.

this.gridGroupingControl1.TableControl.Model.CutPaste.Copy();


insertToolStripMenuItem_Click(sender, e);

this.gridGroupingControl1.TableControl.Selections.Clear();

this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex + 0, cc.ColIndex);

this.gridGroupingControl1.TableControl.Selections.Add(GridRangeInfo.Row(cc.RowIndex));

this.gridGroupingControl1.TableControl.Model.CutPaste.Paste();

this.gridGroupingControl1.TableControl.Selections.Clear();


this.gridGroupingControl1.TableDescriptor.Columns["Discount"].ReadOnly = true;


Sample:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/s_test2f2083473232.zip            

Please let us know if you need any further assistance.

Regards,
Anish.

Gregory Pe
Replied On December 7, 2015 01:21 PM UTC

Hi Anish
1.   save 2 - button1 - error "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."
 contextMenuStripEx1 -  When you use copy, copy, insert ,     -  an error

2. Or is your other solution to the problem

please help

Solai A L [Syncfusion]
Replied On December 8, 2015 11:45 AM UTC

Hi Grzegorz,

Thank you for your update.


 save 2 - button1 - error "Concurrency violation: the UpdateCommand affected 0 of the expected 1 records."
 
contextMenuStripEx1  When you use copy, copy, insert ,     -  an error

As we said already we couldn’t able to reproduce the reported issue at our end. Could you please share us a screenshot or brief explanation of the scenario with a step by step replication procedure or a video. So, that  it would be easy for us to provide a prompt solution.

2. Or is your other solution to the problem 

By default, the Clipboard copy copies only the visible column. If you want to copy the hidden columns value, then you need to customize the copy operation at the application level.

In Keydown event, when the key press is Ctrl+C Copy the selected record to clipboard from data source instead of Grid so that it doesn’t exclude the hidden column.




Regards,

AL. Solai


Gregory Pe
Replied On June 14, 2017 04:28 PM UTC

How to do to properly react

contextMenuStripEx1

After clicking - insert
works properly
When we press - delete

Then -insert
Works not properly

When to delete add
this.test009DataSet.Order_Details.AcceptChanges ();

Does not save changes
  this.order_DetailsTableAdapter.Update (this.test009DataSet);

Please help

Attachment: s_test2f2083473232(3)_dae1a0ad.rar

Mohanraj Gunasekaran [Syncfusion]
Replied On June 15, 2017 05:13 PM UTC

Hi Gregory, 
 
Thanks for your update. 
 
We have created a new incident for your query. So, please follow up with that incident using your direct-trac login, 
 
 
 
Regards, 
Mohanraj G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;