how to show predefined text instrad of value in Repeater.

  • Thread starter Thread starter George Ter-Saakov
  • Start date Start date
G

George Ter-Saakov

Hi. I am trying to show the grid of prices.
But if there is no price I want to show "NA". How can I do that?

Here is the code I am using to display the grid.

<asp:Repeater id=Repeater1 runat="server">
<ItemTemplate>
<tr>
<td width="30%" align="center" nowrap class="btext"><%# ((clsModifier)Container.DataItem).Price.ToString("$#,##0.00")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>


Thanks.
George.
 
Hi George,

How about inserting an IIF in there as you evaluate the item?

<table>
<asp:repeater id=Repeater1 runat="server">
<itemtemplate>
<tr>
<td width="30%" align="center" nowrap ><%#
iif(DataBinder.Eval(Container.DataItem, "UnitPrice")=0,"NA",
format(DataBinder.Eval(Container.DataItem, "UnitPrice"),"$#,##0.00") )%>

</td>
</tr>
</itemtemplate>
</asp:repeater> </table>

Does this help?

Ken
MVP [ASP.NET]


Hi. I am trying to show the grid of prices.
But if there is no price I want to show "NA". How can I do that?

Here is the code I am using to display the grid.

<asp:Repeater id=Repeater1 runat="server">
<ItemTemplate>
<tr>
<td width="30%" align="center" nowrap class="btext"><%#
((clsModifier)Container.DataItem).Price.ToString("$#,##0.00")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>


Thanks.
George.
 
Back
Top