I have been able to properly show the label for a boolean field to show "Yes" or "No" instead of true or false. I did this by adding a DropDownProvider for the column and created a datasource that shows correlates the text to the boolean value. This works great if the grid is in edit mode, but as soon as I set the behavior for CellEditing to be "false" or set the column editing setting to be "readonly" - the value shown in the column is reverted back to "true" and "false". Is there a way to get the text value for the associated boolean value to show up instead?
Currently I am using infragistics 14.1 and the control is the WebDataGrid.
Hello dunhamcd,
Thank you for contacting us.
May I suggest you to use TemplateDataField instead of BoundDataField. When using the template you can specify to a Label for example what text to be displayed.
Code snippet:
Let me know if my suggestion suits your needs.
Thanks for response - this will work. The only caveat is that I have two columns and am removing one on the code behind depending on which mode the grid is in. The only issue that this now presents is that sorting is still done by the boolean text value (aka true / false) rather than the text shown in the template. Any ideas on that?
This behavior is by design, the grid sorting and filtering process the data from the data source. In your case the column have datatype Boolean, so the sorting options will be suited for Boolean values. In order to be able to sort them like strings (yes or no) you should change the column type to be string and in your datasource to return values as strings. Please have a look at the sample below, where I am showing you how to do this:
.....
I hope that you will find this post helpful.