Bind with a condition

  • Thread starter =?ISO-8859-1?Q?Marcelo_Hern=E1n_Ruiz?=
  • 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!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,430
Messages
2,571,676
Members
48,796
Latest member
Greg L.

Latest Threads

Top