Tuesday, October 20, 2015

Add conditional logic to an Eval in a DataItemTemplate in a DevExpress ASPxGridView.

Herein, we may or may not show a hyperlink:

<dx:GridViewDataColumn FieldName="Name" Caption="Name">
   <DataItemTemplate>
      <%# Eval("Id").ToString().Equals("0") ? Eval("Name") : "<a href='" +
            Utilities.GetBaseLinkUrl() + Eval("Id") + "'>" + Eval("Name") + "</a>" %>
   </DataItemTemplate>
</dx:GridViewDataColumn>

 
 

This had the how-to.

No comments:

Post a Comment