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

gdbg currency manager

Thread ID:

Created:

Updated:

Platform:

Replies:

15405 Jun 17,2004 09:59 AM UTC Jun 21,2004 04:14 AM UTC WinForms 9
loading
Tags: GridControl
Lucas Tijssen
Asked On June 17, 2004 09:59 AM UTC

hi, I used the 1.6.1.8 version of syncfusion grid on a gdbg i used a combobox, and on the event GDBG.CurrentCellCloseDropDown I copied the values from the underliing dataview to the gdbg. All worked fine but then I updated to version 2.0.5.1 and it does not work any more. When I put windows combobox on the form and bind it to the same source the currency mananager gives the right position, when I bind a textbox to the datasource it also works fine from the windows combobox but not from the gdbg combobox. Here is the code I use to read the currencymanager: Dim cmSource As CurrencyManager = CType(Me.BindingContext(Me.dvExtraItems), CurrencyManager) Dim drvSource As DataRowView = CType(cmSource.Current, DataRowView) Dim cmTarget As CurrencyManager = CType(Me.BindingContext(Me.dvBookingLineItems), CurrencyManager) Dim drvTarget As DataRowView = CType(cmTarget.Current, DataRowView) drvTarget("accountNumber") = drvSource("accountNumber") etc. GDBGBookingLineItems.Refresh() I think it has something to do with the bindin of the (syncfusion combobox style ) binding to the datasource kindly regards

Administrator [Syncfusion]
Replied On June 17, 2004 10:27 AM UTC

You have to make sure you are using the same bindingcontext as the combobox is using. so, instead of Dim cmSource As CurrencyManager = CType(Me.BindingContext(Me.dvExtraItems), CurrencyManager) try something like this (assuming Me.dvExtraItems is set to be the StyleInfo.DataSource for this column). Dim bc as BindingContext = Me.grid.Model.CellModels("ComboBox").BindingContext Dim cmSource As CurrencyManager = CType(bc(Me.dvExtraItems), CurrencyManager) In 1.6.1.8, there was a problem where in some circumstances the BindingContext of a cell combobox was not being set early enough. Because of this problem, in 2.0, the grid makes sure the BindingContext is set by forcing it to a new BindingContext in these situations. This means that if you want other controls on the form to be in sync with the grid''s embedded combobox, you must somehow ensure they are all using the same BindingContext. If this does not work, if you can post a sample project showing the problem, maybe we can spot the problem.

Lucas Tijssen
Replied On June 18, 2004 05:53 AM UTC

thanks for the effort, i sincerily hope you can help me on this one. I tried to make a small version around the problem. kindly regards gdbg_1134.zip gdbg_5518.zip

Administrator [Syncfusion]
Replied On June 18, 2004 07:53 AM UTC

You can use this code to get the DataRowView you want. Dim cr As GridComboBoxCellRenderer = Me.GDBG1.CurrentCell.Renderer Dim drvSource As DataRowView = Me.dvExtraItems(cr.ListBoxPart.SelectedIndex) MsgBox("value of the selectedindex = " & cr.ListBoxPart.SelectedIndex & vbCrLf & _ "the value of itemDescription = " & drvSource("itemDescription"))

Lucas Tijssen
Replied On June 18, 2004 08:37 AM UTC

thank you, it works, but when I use the combobox the grid does not insert a new row ?! so writing the new values gives an error. Index 0 is not non-negative and below total rows count.

Administrator [Syncfusion]
Replied On June 18, 2004 09:23 AM UTC

How do I see this problem in your sample?

Lucas Tijssen
Replied On June 18, 2004 09:33 AM UTC

if I use the combobox I get the error. When I first make a couple of datarows in the table it works fine. Selecting a value from the combobox should work the same as typing in a cell, making a new row in de dataview. gdbg_2204.zip

Administrator [Syncfusion]
Replied On June 18, 2004 10:15 AM UTC

By default, changes to a row in the grid (and even a new row being added) are not pushed to the datasource until you leave the row. This is why the row is not there when you are trying to use it in your FillDataRow method. You can force the grid to commit the changes at the top of your FillDataRow method so they will be available in the DataSource for you to use at that point. You can do this by adding these lines at the top of that method. Me.GDBG1.CurrentCell.ConfirmChanges() Me.GDBG1.Binder.EndEdit() One other comment on what happens when you do this. You will notice the grid looks like it adds one extra row and then removes it. You can avoid this flash by changing this grid property. Me.GDBG1.CurrentCell.ConfirmChanges(). This is set to true by default in the designer generated code. I think setting it false will avoid the extra row flash. Me.GDBG1.OptimizeInsertRemoveCells = False

Administrator [Syncfusion]
Replied On June 21, 2004 04:00 AM UTC

sorry Clay but that does not solve my problem. As far as I can see is the cause of the problem that when I click the combobox in a empty row it is not recognised as an insert in the grid. when I click in another cell in an empty row as soon as I use a key there is an row inserted in the grid. When I use this way to create some rows in the grid, I can afterwards use the combobox to change the content of the row. kindly regards.

Administrator [Syncfusion]
Replied On June 21, 2004 04:14 AM UTC

Sorry, I put the lines in the combobox event and now it works fine Private Sub grid_SelectionChanged(ByVal sender As System.Object, _ ByVal e As Syncfusion.Windows.Forms.PopupClosedEventArgs) Handles GDBG1.CurrentCellCloseDropDown ''copies values from dvExtraitems to InvoiceLineItems Me.GDBG1.CurrentCell.ConfirmChanges() Me.GDBG1.Binder.EndEdit() thanks

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

;