582
Views
2
Comments
Conditional css on input widget
Question

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

2018-01-19 03-18-31
indra budiantho

hi Goyal,

something like this?

may this helps.

regards,

indra

2019-07-08 11-04-35
Leonardo Fernandes
 
MVP

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.