Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mmmoustache 50 posts 79 karma points
    Mar 01, 2012 @ 11:38
    mmmoustache
    0

    Conditionally run a script based on Doctype

    I'm just trying to figure out how to 'do something' if the current page has a certain doctype. I'm using Umbraco 4.7.0 and razor.

    So far, I've tried a couple of methods and feel like I'm close but I just can't seem to get this to work. Here's what I'm currently up to, which errors with 'Cannot invoke a non-delegate type':

    @if(@Model("nodeTypeAlias == \"thisOne\""))
    {
        "Do Something!"
    }
  • Anthony Dang 1404 posts 2558 karma points MVP 3x c-trib
    Mar 01, 2012 @ 11:45
    Anthony Dang
    1

    @if (Model.NodeTypeAlias == "MyDocType")
    {
      // do something
    }

     

     

  • mmmoustache 50 posts 79 karma points
    Mar 01, 2012 @ 12:13
    mmmoustache
    0

    Thanks man, works like a charm!

Please Sign in or register to post replies

Write your reply to:

Draft