Conditional css on input widget

Conditional css on input widget


i want to apply conditional css to input widget. How i can achieve that. The condition depends on boolean variable

hi Goyal,

something like this?

may this helps.



Hello Lovish. Indra's answer is kind of correct, if you just want to change a single style. Just to make it clearer, you would use your boolean variable instead of the True constant inside the if.

You could also do a similar thing with class name. Suppose you have a list of products, but some products are out of stock. You want to render the out of stock products with some red background. You could set the class extended property (instead of the style extended property) with something like this:

If(ProductsTable.List.Current.Product.IsOutOfStock, "product-out-of-stock", "")

Then you just need to define the product-out-of-stock class in a stylesheet:

.product-out-of-stock { background-color: red; }

This alternative solution has the advantage that you still define the conditional styles in the stylesheet, and not as an inline style.