You need to sign in to do that
Don't have an account?
sampath kumar 3
can we assign css dynamically by using apex
Is it possible to controll CSS from Apex controller
Ex: I'm fetching data by using SOQL query and if data is fetched from SOQL then only need to perform CSS .So I would like to write a condition in apex but how to assign css from apex I have external css file contians list of css classes how can I assign those classes based on the condition in apex without using javascript . Please let me know
Ex: I'm fetching data by using SOQL query and if data is fetched from SOQL then only need to perform CSS .So I would like to write a condition in apex but how to assign css from apex I have external css file contians list of css classes how can I assign those classes based on the condition in apex without using javascript . Please let me know
One possible way to do this would be to create a boolean variable in your controller for example - 'flag'. Set this field to true in your controller when you want to apply css, else set it to false
In your VF page use this 'flag' variable as stated below:
Let me know if you face any issue.
Regards,
Sagar Wahal
Instead of passing a boolean variable, why dont you pass the name of your css class itself.
For example - Create a String cssClassName in your controller. Set the value of the cssClassName according to the condition you want in your controller.
Now in your VF page use it as follows:
Hope, this solves your query. Let me know if you face any issues.
Regards,
Sagar