I have a gridview that is bound to a datasource (Windows Forms, VB.NET). One of columns is a property of type boolean, and I want to show "yes/no" in the column instead of 0/1 or "true/false". Is this possible? Can you edit displays of columns that are bound?
+1
A:
I have encountered the same problem, unfortunately I didn't find an elegant solution. Three workarounds are proposed:
- Add another property to the data source's class, which returns your string representation of the boolean property. Hide the column showing the boolean value, display the column showing the string value.
- Add an unbound string column, populate that column with the appropriate value for each row, and hide the boolean bound column.
- Create a wrapper class for your data class, which exposes the properties as you'd like them to be shown in the datagrid.
M.A. Hanin
2010-03-15 15:30:42