how to show predefined text instrad of value in Repeater.

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default how to show predefined text instrad of value in Repeater.

    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.
    George Ter-Saakov Guest

  2. Similar Questions and Discussions

    1. #7741 [Opn->WFx]: [phpdoc] Document about every predefined variable
      ID: 7741 Updated by: rasmus@php.net Reported By: tictactux at surfeu dot ch -Status: Open +Status: ...
    2. predefined variables
      could anyone provide information about the following predefined variables of coldfusion:MM_redirectLoginSuccess and MM_redirectLoginFailed..... ...
    3. Add formatted text to JavaScript function call during ItemDataBound of a Repeater Control.
      Hello, I am taking values from a datatable and formatting them for use in a JavaScript Function Call. The end result is a mouse over tool tip. ...
    4. Actionscript 2.0: Adding functions to predefined classes?
      I'm currently attempting to bring an extremely large project from Acitonscript 1.0 to Actionscript 2.0. One of the (many) stumbling blocks along the...
    5. Text values within a Repeater
      Hi, I have a repeater, and on post-back when I try to access the Text properties of <asp:label>'s in the repeater, they are all String.Empty (which...
  3. #2

    Default Re: how to show predefined text instrad of value in Repeater.

    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]


    "George Ter-Saakov" <we@hotmail.com> wrote in message
    news:ej4eWK7TDHA.2420@TK2MSFTNGP10.phx.gbl...
    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.


    Ken Cox [Microsoft MVP] Guest

  4. #3

    Default Re: how to show predefined text instrad of value in Repeater.

    Thanks.

    Did not know that IIF exists. Just started to learn .NET

    George.

    "Ken Cox [Microsoft MVP]" <BANSPAMken_cox@sympatico.ca> wrote in message
    news:enA9Ej$TDHA.2264@TK2MSFTNGP11.phx.gbl...
    > 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]
    >
    >
    > "George Ter-Saakov" <we@hotmail.com> wrote in message
    > news:ej4eWK7TDHA.2420@TK2MSFTNGP10.phx.gbl...
    > 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.
    >
    >

    George Ter-Saakov Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139