Bind with a condition

  • Thread starter Thread starter =?ISO-8859-1?Q?Marcelo_Hern=E1n_Ruiz?=
  • Start date Start date
?

=?ISO-8859-1?Q?Marcelo_Hern=E1n_Ruiz?=

I want to do show this:

<asp:Panel id="Panel1" runat="server">
<div>Product dimensions: <%# DataBinder.Eval(Product, "Dimensions") %></div>
</asp:Panel>

Only if "Dimensions" field is not empty.
Is there any way?

The best I think is to do this in the DataBinding Event of the panel

if (Product.Dimensions == "")
divDimensions.Visible = false;

Of course, giving the div tag an id of divDimensions and the runat="server"...
Is there another way?

Thans!!
 
Back
Top