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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

refresh of heirarchy after change of data

Thread ID:

Created:

Updated:

Platform:

Replies:

86939 Jul 9,2009 09:58 PM UTC Aug 6,2009 07:10 AM UTC Windows Forms 7
loading
Tags: GridControl
Tony Davies
Asked On July 9, 2009 09:58 PM UTC

Hi

I have a typical order header/order detail hierachy. I use 2 grids to show these, the detail grid is a drill down and appears when you click the header grid. The binding code is

dgOrderDetails = New GridHierDataBoundGrid(Me, dsOrders.Tables("OrderDetail"), Nothing, Nothing, Nothing, Nothing, False)


dgOrderHeader = New GridHierDataBoundGrid(Me, dsOrders.Tables("OrderHeaders"), dsOrders.Tables("OrderDetail"), dgOrderDetails, New QueryFilterStringEventHandler(AddressOf ProvideOrder_DetailsFilterStrings), New QueryFormatGridEventHandler(AddressOf ProvideOrder_DetailsFormat), True)



Orders are selected from a search which populates dsOrders.Tables("OrderDetail") and dsOrders.Tables("OrderHeader")

It all works fine for the first order found, but when I select another order (ie the tables change), the header gridm is fine, but the detail grid is empty.

I am clearly doing something wrong, i've tried using

dgOrderHeader.Binder.ResetHierarchyLevels()
dgOrderHeader.Model.ResetVolatileData()
dgOrderDetail.Binder.ResetHierarchyLevels()
dgOrderDetail.Model.ResetVolatileData()

But it does not make any difference.

Anyone have any ideas?

Thanks

Lingaraj S [Syncfusion]
Replied On July 11, 2009 08:29 AM UTC

Hi Tony,

Thank you for your interest in Syncfusion product.

Simply if you wan to reset the DataSource in GridDatBoundControl, then please try using GridBoundColumns property and DataSource property in GridDataBoundGrid to achieve this behavior.

Refer the code below:

this.gridDataBoundGrid1.GridBoundColumns.Clear();
this.gridDataBoundGrid1.DataSource = null;
this.gridDataBoundGrid1.DataSource = dSet.Tables[0];
this.gridDataBoundGrid2.GridBoundColumns.Clear();
this.gridDataBoundGrid2.DataSource = null;
this.gridDataBoundGrid2.DataSource = dSet.Tables[1];


Refer the sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.37/GDBGHierarchyRebind.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.

Tony Davies
Replied On July 13, 2009 08:45 PM UTC

Hi,

No that did not work. I changed your c# to this vb .net

dgOrderDetails.GridBoundColumns.Clear()
dgOrderDetails.DataSource = Nothing
dgOrderDetails.DataSource = dsOrders.Tables("OrderDetail")
dgOrderHeader.GridBoundColumns.Clear()
dgOrderHeader.DataSource = Nothing
dgOrderHeader.DataSource = dsOrders.Tables("OrderHeaders")


I added the 2nd ds=nothing as your example did not have it.


Reseting the datasources made the drill down arrows go away, don't I have to reset the hierarchy somehow? Also I couldn't find an entry for GridHierDataBoundGrid in currenty help file. Is this a legacy object? If so what should I be using?


I could not open the sample code as I am using vs 2008 and the conversion process failed. Is it possible to provide the sample in vb .net and not c#? I think I might have a better chance of opening it.


thanks

Tony

Lingaraj S [Syncfusion]
Replied On July 16, 2009 02:34 PM UTC

Hi Tony,

Sorry for the delay.

We have attached the VB.Net sample in below link, this sample shows the rebinding in GridDataBoundGrid.
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.37/GDBGRelation.zip

Please let me know if you still face the issue, try reproduce the steps in this sample it would be helpful to analyze more details on the issue.

Regards,
Lingaraj S.

Tony Davies
Replied On July 17, 2009 06:27 PM UTC

Hi, no your sample code doesn't work for me. It's not really a very good example as it doesn't really do anything does it? The rebind button doesn't change the underlying datasets, it just removes them and attaches them again.

This is my code

Private Sub LoadOrders()
Dim aSQLAddress As New SQLAddress

Try
dsOrders.Reset()
aSQLAddress.GetOrdersByCustomer(dsOrders, lngRecordUID)
Catch ex As Exception
MessageBox.Show("There has been an error in the LoadOrders sub." & _
vbCrLf & _
"The error message is :" & _
vbCrLf & _
ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try


If dgOrderHeader Is Nothing Then
dgOrderDetails = New GridHierDataBoundGrid(Me, dsOrders.Tables("OrderDetail"), Nothing, Nothing, Nothing, Nothing, False)
dgOrderHeader = New GridHierDataBoundGrid(Me, dsOrders.Tables("OrderHeaders"), dsOrders.Tables("OrderDetail"), dgOrderDetails, New QueryFilterStringEventHandler(AddressOf ProvideOrder_DetailsFilterStrings), New QueryFormatGridEventHandler(AddressOf ProvideOrder_DetailsFormat), True)


If Not HandlersInitialised Then
HandlersInitialised = True
InitialiseHandlers()
End If


Else
dgOrderHeader.Binder.ResetHierarchyLevels()
dgOrderDetails.Binder.ResetHierarchyLevels()
dgOrderDetails.GridBoundColumns.Clear()
dgOrderDetails.DataSource = Nothing
dgOrderDetails.DataSource = dsOrders.Tables("OrderDetail")
dgOrderHeader.GridBoundColumns.Clear()
dgOrderHeader.DataSource = Nothing
dgOrderHeader.DataSource = dsOrders.Tables("OrderHeaders")
End If





With dgOrderHeader
.BeginUpdate()
.AllowResizeToFit = True
.Model.ReadOnly = True
.ThemesEnabled = True
.Location = New Point(12, 185)
.Size = New Size((Me.ClientSize.Width - 40), (Me.ClientSize.Height - 225))
.Anchor = (((AnchorStyles.Bottom Or AnchorStyles.Left) _
Or AnchorStyles.Right) _
Or AnchorStyles.Top)
Controls.Add(dgOrderHeader)
.BorderStyle = BorderStyle.FixedSingle
.CurrentCell.Deactivate(True)
.CurrentCell.Activate(1, 2, GridSetCurrentCellOptions.SetFocus)
.ActivateCurrentCellBehavior = GridCellActivateAction.None
.SortBehavior = GridSortBehavior.SingleClick
.Model.ColWidths.ResizeToFit(GridRangeInfo.Cols(1, dgOrderHeader.Model.ColCount))
.EndUpdate()
End With



I have attached the results of a first and second search using this code.

Again, is the GridHierDataBoundGrid object still valid? there is no help for it in the help files.

tony



samples_d861c15d.zip

Lingaraj S [Syncfusion]
Replied On July 22, 2009 04:30 AM UTC

Hi Tony,

Thank you for the update.

If you want to show the DropDown GridDataBoundGrid control depend upon of the OrderHeader GridDataBoundGrid column value, then please try using RowFilter in DataSource to achieve this behavior. The RowFilter was used to filter the value depends upon the column value.

Refer the sample in below link:
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.37/F86939/GDBG2.zip

In this sample the ParentTable and ChildTable was used in GridDataBoundGrid. The DropDown GridDataBoundGrid is shown the value depends upon the parent GridDataBoundControl cell value. The RowFilter was used in this sample to perform that operations.

Please let me know if it is not full fill your requirement.

Regards,
Lingaraj S.

Tony Davies
Replied On August 2, 2009 12:57 PM UTC

Hi,

No I can't use your example. I think you are missing the point a bit. Both your examples preload the datasets and tables etc, and you just change the filter.

In my case the dataset is changed everytime the user select a customer to query and so I have to refresh the bindings in the grid with the new dataset.

Also you have not answered the question about "GridHierDataBoundGrid". I cannot find any documentation for this class. Is it a legacy class that have been replaced by something else? If I could find the documentation I might be able to work out what is going on.

Thanks

Tony

Lingaraj S [Syncfusion]
Replied On August 6, 2009 07:10 AM UTC

Hi Tony,

Thank you for your interest in Syncfusion product.

If you want to rebind the DataSource, then please try using DataSource property in GridDataDoundGrid to achieve this behavior. I have attached a simple sample that illustrates this better.

Refer the sample from below link:
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.37/F86939/GridData.zip

Refer the following link for more details about the GridDataBoundGrid.
http://help.syncfusion.com/ug_73/gridwin/default.html

Refer the Hierarchy Grid sample from the below location in our product Dashboard.
Grid Samples -> Data Bound -> Hierarchy

Please let me know if you have any queries,

Regards,
Lingaraj S.

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

;