I would use xslt or if xsl is not your cup of tea you can make it in asp.net codebehind <div runat="server" id="myDiv">.
You can also do it in jquery by adding <input type="hidden" and put value there and when loading page checking the value and putting $("myDiv").css("overflow","hidden")
Is it possible to use if statement in templates
Hi
I'm using a checkbox in my documenttype. This checkbox represent a style setting for a DIV ...overflow: hidden of auto
I want to use the value of this checkbox to create someting in my template like
<div test style="overflow:hidden;"> when checked
or
<div test style="overflow:auto;">
all depending on the value of the checkbox.
Is this possible in the template or a macro and how ???
Im fairly new to umbraco so any help is welcome..
Maarten
I would use xslt or if xsl is not your cup of tea you can make it in asp.net codebehind <div runat="server" id="myDiv">.
You can also do it in jquery by adding <input type="hidden" and put value there and when loading page checking the value and putting $("myDiv").css("overflow","hidden")
i guess im looking for a solution in xslt although it is new to me.
This means writing a xslt script where i use an if statement. How do i pass the value of the checkbox into the script ??
Maarten
Hi Maarten
I would use XSLT to take care of this problem, and in most cases also use XSLT to render the content inside of the div.
You could make a new XSLT-file (and macro) and insert something like this:
Well, actually I would make the styling in a seperate css-file, and then just have two different clases to apply to the div like this:
Hope you understand, otherwise say so, and we'll figure it out :)
/Kim A
You can do it with server script blocks:
Hi Guy's
Thanks for the response. Both options XSLT and ASP work fine.
ASP Crossed my mind because that's a language i'm familiar with.
But since i'm trying to learn XSLT, the first options is up and running on my site.
I LOVE UMBRACO :)
Maarten
Glad that we could help Maarten.
Please remember to mark an answer as the solution.
/Kim A
is working on a reply...