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. Image for the cookie policy date

Concurrency error in GridGroupingControl

Hello,

I used griddroupingcontrol and populated data from dataset. After make changes and save the dataset, it work fine. But after made further changes in the same table and tried to save the dataset, I got DBConcurrency exception error message. Kindly advise how to correct it?

Thanks for your help and Best Regards,
Harry


8 Replies

HA haneefm Syncfusion Team January 29, 2008 11:39 PM UTC

Hi Harry,

It is hard to trace why this issue is arising without seeing it in a live application. Is there any possible way for you to provide us with a sample that shows this exception? Can you reproduce it in one of our browser samples? It will be easier for us to have a closer look into the problem and to resolve it.

We appreciate your patience, and Thank you for the interest shown in syncfusion Product.

Best regards,
Haneef



HA harisan January 30, 2008 04:34 AM UTC

Dear Haneef,

Please try to trace the problem in the file attached, I've commented any problem in the code since I also got incorrect Header text problem.

Thanks and Best Regards,
Harry



GGC problem of concurrency and header text.zip


HA haneefm Syncfusion Team January 30, 2008 11:13 PM UTC

Hi Harry,

Please use the below code snippet to get the column name of gridcell in a gridgrouping control.

Private Sub gridGroupingControl1_TableControlCellClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
Dim cm As CurrencyManager = e.TableControl.Table.GetCurrencyManager()
Dim dv As System.Data.DataView = cm.List

If Not dv Is Nothing Then
Dim col As GridColumnDescriptor = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex,e.Inner.ColIndex)
If Not col Is Nothing Then
Console.WriteLine(col.MappingName)
Console.WriteLine( dv.Table.Columns.Contains(col.MappingName) )
End If
End If
End Sub

let me know if this helps.

Best regards,
Haneef



HA harisan January 31, 2008 05:02 AM UTC

Hi Haneef,

I got invalid cast exception error as follow:
Unable to cast object of type 'System.Windows.Forms.BindingSource' to type 'System.Data.DataView

on this code: Dim dv As System.Data.DataView = cm.List

Please advise how to avoid this error?

How to change the DragColumnHeaderText of Child, grandchild tables?

Private Sub AddGroupDropAreas(ByVal table As GridTable, ByVal GridName As GridGroupingControl)
Dim t As GridTable
Dim rd As Syncfusion.Grouping.RelationDescriptor = table.TableDescriptor.ParentRelation
If Not (rd Is Nothing) AndAlso rd.RelationKind <> Syncfusion.Grouping.RelationKind.RelatedMasterDetails Then
Return
End If

For Each t In table.RelatedTables
'Console.WriteLine("AddGroupDropArea " + t.Info)

GridName.AddGroupDropArea(t)
'recurse...
AddGroupDropAreas(t, GridName)

'This command failed, and the header text still show default value ! What's wrong??
GridName.GridGroupDropArea.DragColumnHeaderText = "Group Your Data"
Next t
End Sub

Thanks and Best Regards,
Harry




HA haneefm Syncfusion Team February 1, 2008 05:16 PM UTC

Hi Harry,

You can try the below code to get the column headertext in TableControlCellClick event.

Private Sub gridGroupingControl1_TableControlCellClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
Dim column As GridColumnDescriptor = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex,e.Inner.ColIndex)
If Not column Is Nothing Then
Dim colMappingName As String = column.MappingName
Dim colHeaderText As String = column.HeaderText
Console.WriteLine(colMappingName)
Console.WriteLine(colHeaderText")
Console.WriteLine( column.FieldDescriptor.GetPropertyType() )
End If
End Sub

You can use the below code snippet to set the DragColumnHeaderText that is displayed when no columns were added to GroupDropArea.

Dim c As Control
For Each c In Me.GridName.GroupDropPanel.Controls
Dim model As GridGroupDropArea = c
If Not model Is Nothing Then
model.DragColumnHeaderText = "New Text"
End If
Next

Let me know if this helps.

Best regards,
Haneef



HA harisan February 2, 2008 06:48 AM UTC

Hello Haneef,

Yes, both of it worked as expected at last! THANKS.

If I tried to enable column selection by use:
.TableOptions.AllowSelection = GridSelectionFlags.None
.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended

I need to set like above in order to work out this code:
For Each allRecord As SelectedRecord In ggc.Table.SelectedRecords
allRecord.Record.Delete()
Next

The problem is that: I can't enter new record on childtable with foreignkey relation type. Since after we click on pencil icon and click on the new row, the child table immediately closed. It was no problem for childtable with masterdetail relation type.

Please advise me how to make it works for foreignkey relation type child table?


Best Regards,
Harry



HA haneefm Syncfusion Team April 24, 2008 05:20 PM UTC

Hi Harry,

You need to set the ChildTableDescriptor.AllowNew to true to enable AddNewRecord in a Foreign ChildTable. Below are the codes:

GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor();
parentToChildRelationDescriptor.Name = "Child";
parentToChildRelationDescriptor.ChildTableName = "MyChildTable"; // same as SourceListSetEntry.Name for childTable (see below)
parentToChildRelationDescriptor.RelationKind = RelationKind.ForeignKeyReference;
parentToChildRelationDescriptor.ChildTableDescriptor.AllowNew = false;
parentToChildRelationDescriptor.RelationKeys.Add("ForeignCategoryID", "CategoryID");
parentToChildRelationDescriptor.RelationKeys.Add("ForeignInsideCategoryID", "InsideCategoryID");

Best regards,
Haneef



HA harisan May 5, 2008 10:44 AM UTC

Dear Haneef,

In this case, there is no way to add any data of foreign key related table by this way right?

Thanks,
Harry


Loader.
Live Chat Icon For mobile
Up arrow icon