title: How to conditionally show/hide properties of a page in EPiServer 9 CMS admin/backend
body: <p>I have spent a few days banging my head on this one.  There does not seem to be very many examples or resources online so I am hoping someone in the community can assist me.</p>
  
  <p>I have a Page in EPiServer that has an int property that is tagged as a SelectOne (a drop down list).  I need to conditionally show/hide another property of the page type.  I came across <a href="http://world.episerver.com/blogs/Duong-Nguyen/Dates/2014/1/Country-Region-drop-down-lists-in-All-properties-mode/" rel="nofollow">this</a> example online.  I can get it to work as written, but the second I try to modify it (with my very limited knowledge) it ceases to work.</p>
  
  <p>This is my Page in EPiServer:</p>
  
  <pre><code>//'SitePageData' extends page data but is prolly irrelevant to this question
  [ContentType]
  public class LocationPage : SitePageData
  {
      [CultureSpecific]
      [Display(
          Name = "Location Type",
          Description = "",
          GroupName = SystemTabNames.Content,
          Order = 10)]
      [SelectOne(SelectionFactoryType=typeof(LocationTypeSelectionFactory))]
      [UIHint("LocationType")]
      public virtual int LocationType { get; set; }
  
      [CultureSpecific]
      [Display(
          Name = "Address Key",
          Description = "",
          GroupName = SystemTabNames.Content,
          Order = 20)]
      public virtual string AddressKey { get; set; }
  
      //........Rest of class properties here.......
  }
  </code></pre>
  
  <p>This is my Editor Descriptor:</p>
  
  <pre><code>[EditorDescriptorRegistration(TargetType=typeof(string), UIHint="LocationType")]
  public class LocationTypeEditorDescriptor : EditorDescriptor
  {
      public override void ModifyMetadata(EPiServer.Shell.ObjectEditing.ExtendedMetadata metadata, IEnumerable&lt;Attribute&gt; attributes)
      {
          ClientEditingClass = "alloy/LocationType";
          base.ModifyMetadata(metadata, attributes);
      }
  }
  </code></pre>
  
  <p>This is my JS file (LocationType.js) located in the /ClientResources/Scripts/ folder</p>
  
  <pre><code>define([
      "dojo/_base/declare",
      "dojo/_base/lang",
  
      "epi/shell/layout/SimpleContainer"
  ],
  function (
      declare,
      lang,
  
      SimpleContainer
  ) {
  
          return declare([SimpleContainer], {
              addChild: function (child) {
                  // Summar: Add a widget to the container
                  this.inherited(arguments);
                  if (child.name.indexOf("locationtype") &gt;= 0) {
                      this.own(child.on("change", lang.hitch(this, this._updateDropdown)));
              },
  
              _updateDropdown: function (obj) {
                  console.log(obj.value);
              } 
          }
      });
  });
  </code></pre>
  
  <p>As you can see I am just trying to register an on change event (like in the linked example above).  I assume this is the key functionality I would need to then selectively hide the "AddressKey" field.  As you can see I haven't tackled the first problem yet.</p>
  
  <p>I think one of my problems is I am potentially extending the wrong container type in dojo.  I don't know enough to know for sure however. </p>
  
  <p>Has anyone implemented a similar functionality in EPiServer?  Is this just a super simple Dojo question?  </p>
  
  <p>I appreciate any and all help, thanks in advance !</p>