Howdy,
I have tons of grids in our application. Every grid except one presents a Boolean or bit from SQL as a checkbox. This one gird that does not work shows True and False. When you click in the cell it then turns into a checkbox. How do I make it look like a checkbox like have on every other grid? I am not setting any special setting on the other grids for it to work.
Thanks,M
The grid will automatically show a checkbox for any field whose DataType is boolean. I'm not sure about a bit field, but as long as it's a Boolean in DotNet, it will default to CheckBox Style.
If it's not doing that, the something you are doing is overriding it. The obvious things to check would the Style or EditorComponent property of the column or cells.
From my experience with other grids in our application the 'bit' field, or the SQL equiv. of Boolean always translates to a checkbox. But the behavior on this one grid is such that the cell shows the word True and False. However when I click in the cell, it shows as a checkbox.
If I asked you how can I configure the cell to behave like that, how would I even do it?
Thanks,M.
Hello,
Unfortuantely the grid does not have this built in and would need some code to be set like the sample demonstrates to achieve the behavior you desire. You can submit a feature request on our ideas website.
I am not sure if you are actually reading my post.
Let me say this again.
I have a grid. I have no special code on that grid other than what I said in the previous post about the cell click action.
When the grid loads, it displays any Boolean value with test True/False.
When I click in the cell, I get a checkbox.
EVERY OTHER GRID IN MY ENTIRE APPLICATION OF WHICH THERE ARE 100 OF THEM AT LEAST DOES NOT BEHAVE THIS WAY.
Why, and how to I get it so that the grid only displays a checkbox JUST LIKE THE REST OF THE GRIDS DO.
I asked how would you even get a grid to behave this way so I could double check the settings of the grid to see that I don't have anything strange set.
Thanks,
M.
I apologize for the misunderstanding but from your earlier post I made a sample of how you would achieve clicking a cell to display a checkbox. You can make sure that a column in the grid displays checkboxes by setting the Style property on the cooresponding column to 'Checkbox'.
UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns[0]; column.Style = ColumnStyle.CheckBox
UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns[0];
column.Style = ColumnStyle.CheckBox
Please attach a solution project that contains two grids with columns behaving differently that demonstrates the behavior and we can certainly investigate this further. Let me know if you have any questions.
It is really hard for me to attach my project as it is a heavily integrated system with a couple hundred thousand lines of code + Database.
Sorry, 1st post is the picture when you click in the cell, here it is when out of the cell.
CellDisplayStyle is a performance optimization. By setting it to FormattedText, the grid cell display the text using a TextUIElement and does not use an editor in the cell. This can boost performance a little since it requires less elements to paint the cell, but you lose a little functionality, too, like CheckBoxes.
The property exists on the Column and the Override. So you can set it on each individual column or the band or the DisplayLayout.
If you are setting it on the Band or DisplayLayout's override, then it affects the whole grid, but you can still override it on each individual column.
There's no way to set a single property and have it apply to all checkbox columns, though. You would have to loop through your columns and set the property on each Checkbox column individually.
Hi Mike,
Thanks for responding that means a lot.
Yes when we leave the cell it goes back to being text. We are setting ONE of the columns though to be PlainText (e.Bands[0].Columns["qty'].CellDisplayStyle = x). Would that effect the entire grid?
Looking at the properties in the UI designer of that grid the display style is set to FormattedText....when I set that to Default BANG it works correctly!!!
Now...I don't know why we put formattedText...I can't remember (I have to research). If i have to set that back to FormattedText...can I just in the override method set the DispalyStyle for booleans to be default?
Thanks...finally this mystery is solved!
Hi,
What is the behavior you are getting, now? You say that the cell shows True/False as a string, but then when you click on the cell it changes to a CheckBox. Does it change back to a string when you leave the cell?
If so, then that seems to indicate that the cell is using different editors or controls depending on whether or not the cell is in edit mode.
You could achieve that by applying a ControlContainerEditor to the cell, either via the Editor or EditorComponent property of the column or cell, where your ControlConatinerEditor has a CheckBox or UltraCheckEditor as it's EditingControl and some other control (or nothing) assigned to the RenderingControl.
That seems unlikely, though, since you would have had to go out of your way to set that up.
Another possibility which seems much more likely and would be easier to overlook would be if you were setting the CellDisplayStyle property, either on the column or the Override for the band or layout. This property is an optimization that improves performance, but reduces the functionality of certain cells by bypassing the editor. A setting of CellDisplayStyle.PlainText results in exactly the behavior you describe here - assuming leaving the cell reverts to cell back to text.
Sorry I know this is a year old but we got busy with some other stuff but this is still an issue. Could there be some other setting that would create behavior in this way? How would I even get it to be this way if I wanted to?
I haven't reproduced the issue yet but I created a more simplfied sample that connects the UltraGrid to a local SQL Server Compact database file. I included a button to toggle the column style and the field in the dbo is a bit type.
Let me know if you have any questions. Please, if you can attempt to reproduce the behavior with this sample; send it back to us so I can investigate this further. Thanks.