Re: Spark condition on control status

Skip to first unread message

Rob G

Oct 27, 2012, 5:45:00 AM10/27/12
Hi yoli,

Think if the condition inside a Spark if block as C# rather than JavaScript. It gets evaluated before the page is ever sent down to the browser, so it doesn't really make sense to put JavaScript in there and expect it to be evaluated at a later stage. You should rather have "daily" as a boolean property on your viewmodel, and then use that to render the view like this for example:

<viewdata model="MyNameSpace.MyViewModelClass" />

<if condition="Model.IsDaily" >
   <!-- rendered if true -->


On Fri, Oct 26, 2012 at 8:37 AM, yoli <> wrote:

I wanted to conditionally show part of HTML, but why can't I do this in Spark?

                  <if condition="document.getElementById('daily').checked">

or this, if I'm using Propotype

                  <if condition="$('daily').checked">

You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply all
Reply to author
0 new messages