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

GDBG - Slave combo using different DataSource

Thread ID:

Created:

Updated:

Platform:

Replies:

19541 Sep 28,2004 04:49 PM UTC Sep 29,2004 03:58 PM UTC Windows Forms 4
loading
Tags: GridControl
Steve Gauthier
Asked On September 28, 2004 04:49 PM UTC

I have a slave combo column in a GDBG that can have different DataSource considering the item selected in another column (master combo). My slave combo is not only a filtered view of the original table as explained in the article http://www.syncfusion.com/Support/article.aspx?id=567. The DataSource of my slave combo is a different table in the DataSet with a different ValueMember and DisplayMember for each value that can be choosen in the master column. I tried to override OnCurrentCellShowingDropDown() but it didn''t work. Is there a way to do it? Thanks, Steve

Administrator [Syncfusion]
Replied On September 28, 2004 05:56 PM UTC

You can try handling grid.Model.QueryCellInfo. In your handler, when e.RowIndex and e.ColIndex point to the slave cell, you can then set e.Style.DataSource, e.Style.DisplayMember and e.Style.ValueMember to what ever it should be based on the value in the Master combo. You will probably want to cache all the datatables that you need so you do not try to do some time consuming operation (like a SQL query) to get the desired datatable in QueryCellInfo. In QueryCellInfo, your operations should be just lookups whenever possible.

Steve Gauthier
Replied On September 29, 2004 11:41 AM UTC

Thanks. And how can I access to my master combo value directly from the DataTable instead of using the e.RowIndex and the index of the master column in my QueryCellInfo handler? I want to re-use my derived grid class in a few different dialogs and the master column will not be at the same position for all the forms showing this grid. Moreover for some forms the master column will not be shown. Steve

Administrator [Syncfusion]
Replied On September 29, 2004 12:12 PM UTC

If you are not supporting sorting, then you can get the row position and col position in the datatable using: int rowPos = this.grid.Binder.RowIndexToPosition(e.RowIndex); int colPos = this.grid.Binder.ColIndexToField(e.ColIndex); object val = dataTable1.Rows[rowPos][colPos]; If you are supporting sorting then you need to access the values through the CurrencyManager. CurrencyManager cm = (CurrencyManager) this.grid.BindingContext[this.grid.DataSource, this.grid.DataMember]; int rowPos = this.grid.Binder.RowIndexToPosition(e.RowIndex); int colPos = this.grid.Binder.ColIndexToField(e.ColIndex); object val = ((DataRowView)cm.List[rowPos])[colPos];

Steve Gauthier
Replied On September 29, 2004 03:58 PM UTC

Thanks for your support. It''s working perfectly! Steve

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

;