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.

DataBoundGrid: rebind datasource.

Thread ID:

Created:

Updated:

Platform:

Replies:

17833 Aug 17,2004 08:57 PM Aug 19,2004 12:47 AM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 17, 2004 08:57 PM

Hello ! I have databound control and one column has drop down style. But the problem is to display for user in drop list only values, that weren''t yet entered as values in the column. My idea is to re-initialize datasource just before user opens drop-down list. So, I want to ask following 2 quesions: 1) When is the better place to re-calculate and re-bind datasource. (what event handler) 2) And how to enumerate values (actually strings) already entered in the column. Thanks.

Administrator [Syncfusion]
Replied On August 18, 2004 01:08 AM

You can use the CurrentCellShowingDropDown event to set values into a droplist. If you have a list of strings you want to use as the drop values, then you can use a StringCollection object and set it as the ChoiceList property of the cell style. Here is a sample that changes the ChoiceList shown in column 2 based on the value set in column 1 using CurrentCellShowingDropDown. You can see other choicelist usage in the Grid\Samples\CellTypes\ComboBoxes sample. There is also a KB on dynamic combobox lists though it uses DataTables and not choicelists. http://www.syncfusion.com/Support/article.aspx?id=567

Administrator [Syncfusion]
Replied On August 18, 2004 03:25 AM

Right, but I want to avoid showing in drop down list values, that were already entered in the table. So, the problem could be solved by enumeration of values, that already in the table.

Administrator [Syncfusion]
Replied On August 18, 2004 03:43 AM

You are free to build your list in CurrentCellShowingDropDown in any manner you care to. If you want to go through the column in the grid and remove values from your droplist that are already in the grid, you can do so. Of course, this may mean that your droplist could be empty depending on exactly what is displayed in the grid column and what was originally in your droplist. The main point is that in CurrentCellShowingDropDown, you can dynamically provide what droplist you want to see. How you construct this list is up to you.

Administrator [Syncfusion]
Replied On August 18, 2004 08:49 PM

Hello ! Ok, I''ve done the necessary fuctionality. Thank you. One small question here: After selection of value from drop duwn list, implemented as you recommend, inner exception occures: catched at Syncfusion.Windows.Forms.Grid.GridComboBoxCellRenderer.set_ControlText(String value) in :line 0 Is there a way to avoid the exception ? Thank you.

Administrator [Syncfusion]
Replied On August 19, 2004 12:47 AM

You will have to track down what is causing the exception. If you can post a complete call stack, we might be able to suggest something. Event better is if you can post a sample that we can use to reproduce teh problem. The kinds of things you need to look for might include conversion problems like you column requireing an integer and for some reason it is getting a string value that does not parse to an integer. Another problem that might appear is that the column itself has to have a datasource set for its combobox setting. If you have set DropDownStyle for the column to be exclusive, this means you can only have values in the cell that are actually in the DataSource for the whole column. So, you would have to have the column DataSource include all possibilities or change this setting.

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.

;