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.

Grid ComboBox Refresh wierd behavior

Thread ID:

Created:

Updated:

Platform:

Replies:

29322 May 23,2005 12:01 PM May 23,2005 02:33 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 23, 2005 12:01 PM

Hi, I am having trouble refreshing values in a databound combobox inside a grid. I am attaching a sample project that shows the behavior. Here is what the problem is: I have a tabControl with 2 tab pages. Both tab pages have databoundgrids, grid1 and grid2. grid1 is bound to dataview dvGrid1 and grid2 is bound to dvGrid2. Grid2 has a combo box as one of its columns. I want to refresh the value of the combo box based on the values entered in grid1. I get the currencyManager of the combobox and call the refresh method after updating the arraylist, which is the datasource for the combo. The wierd behavior I see is: THe combo will refresh as long as tab2 doesn''t get the focus. The following steps explain this: 1. Run the app 2. Without switching to tab2, enter a couple of rows in the grid (enable, name columns) 3. Click on tab2 4. Check that the combo has the values entered on tab1 5. Go back to tab1, enter another row 6. Go back to tab2, the value just entered is not populated. When I call cm.Refresh() on line 224, I see the count is updated with the newly added item, but it just doesn''t show up in the combobox. What am I doing wrong here? Thanks for your support, GridTest_3365.zip

Administrator [Syncfusion]
Replied On May 23, 2005 12:52 PM

The grid does not dynamically reload combobox celltype''s DataSources. It assumes that these data sources are static and once loaded, does not try to reload thm every time. This is done for performance reasons. If you want to force them to be reloaded, you can handle CurrentCellShowingDropDown and do the work there. Here is code that worked for me in your sample.
private void grid2_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
{
	GridComboBoxCellRenderer cr = this.grid2.CurrentCell.Renderer as GridComboBoxCellRenderer;
	if(cr != null)
	{
		
		object o = cr.ListBoxPart.DataSource;
		cr.ListBoxPart.DataSource = null;
		cr.ListBoxPart.DataSource = o;
	}
}
 

Administrator [Syncfusion]
Replied On May 23, 2005 02:33 PM

That worked great! Thanks again. >The grid does not dynamically reload combobox celltype''s DataSources. It assumes that these data sources are static and once loaded, does not try to reload thm every time. This is done for performance reasons. > >If you want to force them to be reloaded, you can handle CurrentCellShowingDropDown and do the work there. Here is code that worked for me in your sample. > >
>private void grid2_CurrentCellShowingDropDown(object sender, GridCurrentCellShowingDropDownEventArgs e)
>{
>	GridComboBoxCellRenderer cr = this.grid2.CurrentCell.Renderer as GridComboBoxCellRenderer;
>	if(cr != null)
>	{
>		
>		object o = cr.ListBoxPart.DataSource;
>		cr.ListBoxPart.DataSource = null;
>		cr.ListBoxPart.DataSource = o;
>	}
>}
> 

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.

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.

;