asp.netboundfield

asp:BoundField view the values with a condition


i have a dataview with:

<asp:BoundField DataField="AccontoAutorizzato" HeaderText="Acconto Aut." 
                        SortExpression="AccontoAutorizzato" dataformatstring="{0:C}"  />

is possible hide the values of each with a condition like

 Visible=<%# ((Int32)Eval("StatoID") < 2) %>

?

Thanks


Solution

  • It's possible with following

    <asp:TemplateField HeaderText="Acconto Aut." >
         <ItemTemplate>
              <asp:Label ID="lbl" runat="server" Text='<%# Bind("AccontoAutorizzato") %>'
                            Visible='<%# ((int)(Eval("StatoID")) < 2) %>' />
         </ItemTemplate>
    </asp:TemplateField>