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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

gridboundcolumns, combobox and string types

Thread ID:

Created:

Updated:

Platform:

Replies:

11826 Mar 16,2004 08:13 PM UTC Mar 17,2004 10:41 AM UTC WinForms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On March 16, 2004 08:13 PM UTC

Hi, I have a GridDataBoundGrid, for which I am building the GridBoundColumns collection by hand, column by column. I am trying to implement a ComboBox celltype on my grid. I have a simple demo that seems to work for enum types, but for a column with a string type, there are problems. In grid.PrepareViewStyleInfo, I am setting the following properties: StringCollection sc = new StringCollection(); sc.AddRange(...); style.CellType = "ComboBox"; style.DropDownStyle = GridDropDownStyle.Exclusive; style.ChoiceList = sc; What I am seeing is that the cell displays the drop-down arrow, but clicking on the arrow fails to drop down the list, and in every other way the cell behaves as a textbox. Any suggestions to make this work would be greatly appreciated.

Administrator [Syncfusion]
Replied On March 16, 2004 10:43 PM UTC

PrepareViewStyleInfo is generally used for visual properties that are needed to draw the cell, like BackColor or Font. Properties that pertain to cell functionality like ReadOnly or Enabled or setting a Choicelist for a combobox, need to be done earlier in Model.QueryCellInfo. One comment is that you should only use either of these events if you need to dynamically set the properties on a whole column, or if you only want to set them for some cells in a column. If the properties apply to the whole column in a non-dynamic manner, then you should set the GridBoundColumn.StyleInfo for the column. This avoids these events (which are hit quite often) and probably gives better performance.

Administrator [Syncfusion]
Replied On March 17, 2004 02:39 AM UTC

Thanks for your suggestions. Unfortunately, in most cases, the properties Im setting are capably of varying on a cell-by-cell basis.

Administrator [Syncfusion]
Replied On March 17, 2004 04:22 AM UTC

Your previous suggestion on the roles of PrepareViewStyleInfo and QueryCellInfo worked. Thanks for that. Im now seeing the drop-downs appearing and functioning correctly. One problem remains... when I drop down the list and select a value, that value is shown in the cell, but isnt written to the datasource until you move the focus out of the cell, or press return or somesuch. I want selecting an item from the drop-down to immidiately display in the cell and write to the underlying datasource. I have DirectSaveCellInfo=true, but I dont think this is enough. The behaviour Im seeing would seem to be bound to the drop-down itself.

Administrator [Syncfusion]
Replied On March 17, 2004 10:37 AM UTC

You can try this. In CurrentCellCloseDropDown, if the reason is not a cancel, then try calling grid.CurrentCell.ConfirmChanges. This should save the value at this point.

Administrator [Syncfusion]
Replied On March 17, 2004 10:41 AM UTC

If ConfirmChanges is not enough to flush the value to the DataSource, then also try calling grid.Binder.EndEdit. The reason ConfirmChanges may not be enough is that the grid will cache changes to a row, and only call binder.EndEdit when you leave the row, and it is this point that the changes finally get saved.

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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;