title: In Sitecore, getting the rendering using context.Parameters["renderingId"] and GetItem
body: <p>I have multiple renderings and I'm adding a help button to the Custom Experience Toolbar for each one that opens a new window and jumps to a specific anchor in the help file. I want the anchor to match the name of rendering such as "Container" or "Event List". So I made a custom command and I'm trying to get to the rendering item using this method but for some reason targetItem is always null. What am I doing wrong?</p>
  
  <pre><code>public class Help : Command
  {
      public override void Execute(CommandContext context)
      {
          Assert.ArgumentNotNull(context, "context");
          Assert.IsNotNull(context.Items, "context items are null");
          Assert.IsTrue(context.Items.Length &gt; 0, "context items length is 0");
  
          StringBuilder data = new StringBuilder();
  
          var renderId = context.Parameters["renderingId"];
  
          if (Sitecore.Data.ID.IsID(renderId))
          {
              Sitecore.Data.Items.Item targetItem =
                  Sitecore.Context.Database.GetItem(renderId);
  
              if (targetItem != null) //never gets the item for me to access it's properties
              {
                  data.Append("Rendering Name: " + targetItem.ToString() + "\r\n");
                  data.Append("Rendering Display name: " + targetItem.Name + "\r\n");
              }
  
          }
  
      }
  }
  </code></pre>