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.
ADAdministrator Syncfusion Team March 30, 2004 01:07 PM
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?
ADAdministrator Syncfusion Team March 30, 2004 01:45 PM
>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:
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).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 220.127.116.11
ADAdministrator Syncfusion Team March 30, 2004 06:01 PM
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?
ADAdministrator Syncfusion Team March 31, 2004 07:38 AM
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.
ADAdministrator Syncfusion Team March 31, 2004 08:13 AM
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.
ADAdministrator Syncfusion Team April 1, 2004 06:04 AM
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
ADAdministrator Syncfusion Team April 1, 2004 07:24 AM
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?
ADAdministrator Syncfusion Team April 1, 2004 07:30 AM
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.
ADAdministrator Syncfusion Team April 1, 2004 09:00 AM
(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?
ADAdministrator Syncfusion Team April 1, 2004 10:54 AM
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.