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

Strange behavior with GridDataBoundGrid and ComboCell

Thread ID:

Created:

Updated:

Platform:

Replies:

12449 Mar 30,2004 05:33 PM UTC Apr 1,2004 03:54 PM UTC Windows Forms 10
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 30, 2004 05:33 PM UTC

I am seeing some strange behavior with a GridDataBoundGrid, using a ComboCell. I am using the CurrentCellShowingDropDown event to filter the values that a user can select from a ComboCell. For some reason, if the user clicks inside the cell, while the drop down list is displayed, and the text in the cell is empty, then the dropdown list will be redrawn with the datasource used by the gridBoundColumn. Note: This only occurs if the text for the field is empty. If the cell has some selected text, it will not happen. Does anyone have any ideas on how to prevent this, or what event i need to handle. Thanks, Michael Sabin

Administrator [Syncfusion]
Replied On March 30, 2004 06:07 PM UTC

So, you are losing your filtered list when you click into the enpty cell. Are there any exceptions being shown in the output window when this happens? Is your combobox datasource the same datatable as the grid''s datasource? If you can post a sample showing the problem here or in a Direct Trac support incident, we can try to spot the problem? If you cannot post a sample, what version of our grid are you using and what code are you using to filter the list in CurrentCellShowingDropDown?

Administrator [Syncfusion]
Replied On March 30, 2004 06:45 PM UTC

>Are there any exceptions being shown in the output window when this happens? > No, I am not seeing any exceptions being thrown. >Is your combobox datasource the same datatable as the grid''s datasource? > Yes and no. I am changing the dataview that is being used for the cell. The dataviews that are used for the datasource will be from different datables, but the dataview used in the Cell contains a subset of the items contained in the dataview used by the grid column. >If you can post a sample showing the problem here or in a Direct Trac support incident, we can try to spot the problem? > Here is a semi example of what is going on: In loading: gbcFood.StyleInfo.DataSource = this.dataTableFood; gbcFood.StyleInfo.DisplayMember = "obj_name"; gbcFood.StyleInfo.ValueMember = "id"; In CurrentCellShowingDropDown handler: if (selectedType == "Vegtables") { this.dataViewFood.Table = dataTableVegtables; } if (selectedType == "Fruit") { this.dataViewFood.Table = dataTableFruit; } GridComboBoxCellRenderer cr = cc.Renderer as GridComboBoxCellRenderer; if (cr != null) { this.dataViewFood.Sort = "obj_name"; ((GridComboBoxListBoxPart)cr.ListBoxPart).DataSource = this.dataViewFood; ((GridComboBoxListBoxPart)cr.ListBoxPart).DisplayMember= "obj_name"; ((GridComboBoxListBoxPart)cr.ListBoxPart).ValueMember = "id"; } >If you cannot post a sample, what version of our grid are you using and what code are you using to filter the list in CurrentCellShowingDropDown? > I am using version 1.6.1.8

Administrator [Syncfusion]
Replied On March 30, 2004 11:01 PM UTC

I tried to see this problem in the sample in this KB. http://www.syncfusion.com/Support/article.aspx?id=567 It sets the list for a combobox in a manner similar to what you are doing. When you change the value in col2, it sets the value in col3 to empty and when the drop happens, it sets the list to a filtered dataview. If you click into the empty sell in that sample, it does not affect the dropdown list. What settings are you using for DropDownStyle? If you change this setting, does it affect teh problem?

Administrator [Syncfusion]
Replied On March 31, 2004 12:38 PM UTC

I am setting the DropDownStyle to Exclusive. I have tried it with KB sample (also setting the DropDownStyle to Exclusive), and it seems fine there. When I don''t set the DropDownStyle to Exclusive, in my app, it seems to work ok. However, I need to have it set to Exclusive.

Administrator [Syncfusion]
Replied On March 31, 2004 01:13 PM UTC

Does your grid''s datatable allow nulls in the column that holds the comboboxes? This might affect the behavior. Normally something like this would throw an exception. Did you try setting the debugger to break on any exception in case there is some handled exception being thrown. If you can modify the KB sample to show the problem or post a sample showing the problem, we can try to debug it here.

Administrator [Syncfusion]
Replied On April 1, 2004 11:04 AM UTC

Ok, i was able to reproduce the problem on the sample. It seems like it only happens when I do not clear out the text for the slave column, when I change the value for the master column. Note: Look at C# file kb-grid-Files-forum_MasterSlaveCombo_7955.zip

Administrator [Syncfusion]
Replied On April 1, 2004 12:24 PM UTC

Thank you for the sample. I can see the problem, and we will look into it. But maybe setting the slave value to the empty string (or some proper default value on the master selection) does make sense from a UI aspect. It would be strange to see Fruit in the master column and then have potatoes showing in the slave column. Does doing this in your application work around the problem?

Administrator [Syncfusion]
Replied On April 1, 2004 12:30 PM UTC

Thanks. Actually, for my app, it doesn''t make sense to do this. In some cases, we allow the field to have certian values but the user can only select a subset of those values. The other ones can be set by the system. Other times, we want to increase the number of avalible options, if a user made a specific choice in another column. In this case, we wouldn''t want to clear out the old value, if it was still valid.

Administrator [Syncfusion]
Replied On April 1, 2004 02:00 PM UTC

(I thought??) I could only see the problem when I was clicking on an empty cell. Was that the case with you? In that case, explicilty setting the value to an empty string would not likely confuse the user, would it?

Administrator [Syncfusion]
Replied On April 1, 2004 03:54 PM UTC

Yes, I could only see the problem when I clicked on an empty cell. If there was text in that cell, then the problem would not occur. It might not confuse the user that much, but to the user the fields shouldn''t have a master / slave relationship. I.E. for my app, we are using network objects. In the grid we have an external address and an internal address. The user can chose to have either a host or a network selected for those fields, but if they select a host in one, they need to select a host in the other (same goes for choosing a network). I would like to give the user the freedom to select them in whatever order they choose, but if they select the internal first, I will filter the choices for the external to automatically be the same type. There is also a case where there is no master cell, and we cannot clear the value. In this case, I still see the same behavior. Here, I only allowing the user to select specific items, but the application has the ability to select one of the other options that are not given to the user.

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

;