GGC, InsertRow, Set Values into inserted row
Hi,
I use the GGC associated with the DataTable.
I want to insert a Row into the GGC(and DataTable) by specified index.
Immediately after insertion of a Row I must fill it with values from other specified grid cells.
For example:
DataTable and GGC before insert
-----------------
N | col1 | col2
-----------------
1 | aaaa | bbbb
-----------------
2 | cccc | dddd
And I want insert new row afret row [1], and set value in [col1] from [1][col1], and vaule in [col2] from [2][col2]
-----------------
N | col1 | col2
-----------------
1 | aaaa | bbbb
-----------------
3 | aaaa | dddd
-----------------
2 | cccc | dddd
Could you help how can i do it?
I use the GGC associated with the DataTable.
I want to insert a Row into the GGC(and DataTable) by specified index.
Immediately after insertion of a Row I must fill it with values from other specified grid cells.
For example:
DataTable and GGC before insert
-----------------
N | col1 | col2
-----------------
1 | aaaa | bbbb
-----------------
2 | cccc | dddd
And I want insert new row afret row [1], and set value in [col1] from [1][col1], and vaule in [col2] from [2][col2]
-----------------
N | col1 | col2
-----------------
1 | aaaa | bbbb
-----------------
3 | aaaa | dddd
-----------------
2 | cccc | dddd
Could you help how can i do it?
SIGN IN To post a reply.
6 Replies
AK
Arseny Khutoriansky
September 4, 2009 05:42 PM UTC
-----------------
N | col1 | col2
-----------------
1 | aaaa | bbbb
-----------------
3 | aaaa | dddd
-----------------
2 | cccc | dddd
Sorry, this example of result is not correct!
The correct result is:
-----------------
N | col1 | col2
-----------------
1 | aaaa | bbbb
-----------------
2 | aaaa | dddd
-----------------
3 | cccc | dddd
JJ
Jisha Joy
Syncfusion Team
September 7, 2009 08:32 AM UTC
Hi Arik,
The GridGroupingControl displays data which is provided by the underlying data source. So to add/remove a record to/from specified location in gridgroupingcontrol, you have to work with the underlying datatable. Please refer to the following code snippets.
Sample for you reference:
http://files.syncfusion.com/support/Grid.Windows/F89763.zip
Thank you for using Syncfusion products.
Regards,
Jisha
The GridGroupingControl displays data which is provided by the underlying data source. So to add/remove a record to/from specified location in gridgroupingcontrol, you have to work with the underlying datatable. Please refer to the following code snippets.
//To add a new record at a specific index in grid
DataRow dr = dt.NewRow();
dr["SNo"] = "A100";
dr["StudentID"] = "AS100";
dr["Department"] = "CSE";
dr["Year"] = "I";
dr["Location"] = "City";
dt.Rows.InsertAt(dr, 5);
Sample for you reference:
http://files.syncfusion.com/support/Grid.Windows/F89763.zip
Thank you for using Syncfusion products.
Regards,
Jisha
AK
Arseny Khutoriansky
September 9, 2009 06:05 AM UTC
Thank you.
I have one more question.
How to highlight any row in the GGC or mark it as selected?
I have one more question.
How to highlight any row in the GGC or mark it as selected?
JJ
Jisha Joy
Syncfusion Team
September 10, 2009 08:55 AM UTC
Hi Arik,
You could highlight any row in GridGroupingControl when it is selected or clicked by setting the TableOptions.ListBoxSelectionMode property. see the code:
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;
Let me know if you have any further queries.
Regards,
Jisha
You could highlight any row in GridGroupingControl when it is selected or clicked by setting the TableOptions.ListBoxSelectionMode property. see the code:
this.gridGroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.One;
Let me know if you have any further queries.
Regards,
Jisha
AK
Arseny Khutoriansky
September 14, 2009 07:33 AM UTC
Thank you.
But I meant a little more.
This property(TableOptions.ListBoxSelectionMode) I already use.
And I need the following:
The user makes a right-click on any row in the grid, pop up a context menu, user select "Insert Below". Row is inserted, but the cursor (selection) remains on the previous row. But I want the selection moved to the newly inserted row. I have index of inserted row, how do I select it by index?
But I meant a little more.
This property(TableOptions.ListBoxSelectionMode) I already use.
And I need the following:
The user makes a right-click on any row in the grid, pop up a context menu, user select "Insert Below". Row is inserted, but the cursor (selection) remains on the previous row. But I want the selection moved to the newly inserted row. I have index of inserted row, how do I select it by index?
JJ
Jisha Joy
Syncfusion Team
September 14, 2009 12:09 PM UTC
Hi Arik,
You could use the CurrentCell.MoveTo method to move the cursor to the newly inserted row. See the code:
Please let me know if this helps.
Regards,
Jisha
You could use the CurrentCell.MoveTo method to move the cursor to the newly inserted row. See the code:
private void menuItem2_Click(object sender, EventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
DataRow dr = parentTable.NewRow();
dr[0] = 7;
dr[1] = "new";
dr[2] = "new";
parentTable.Rows.InsertAt(dr,cc.RowIndex-2);
this.gridGroupingControl1.TableControl.CurrentCell.MoveTo(cc.RowIndex+1 , cc.ColIndex);
this.gridGroupingControl1.TableControl.CurrentCell.BeginEdit();
}
Please let me know if this helps.
Regards,
Jisha
SIGN IN To post a reply.
- 6 Replies
- 2 Participants
-
AK Arseny Khutoriansky
- Sep 4, 2009 05:38 PM UTC
- Sep 14, 2009 12:09 PM UTC