Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
888
BoundDataField show alternative text to value from datasource
posted

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.  

Parents
No Data
Reply
  • 20255
    Offline posted

    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:

    1. <ig:TemplateDataField Key="Discontinued" Header-Text="Discontinued">
    2.                         <ItemTemplate>
    3.                             <asp:Label ID="Discontinued" runat="server" Text='<%# (bool)Eval("Discontinued") ? "Yes": "No" %>'></asp:Label>
    4.                         </ItemTemplate>
    5.                     </ig:TemplateDataField>

    Let me know if my suggestion suits your needs.

Children