title: Check if Dojo's content pane is available or not
body: <p>I have a requirement where I need to create a <code>dojox.layout.ContentPane</code> programmatically.</p>
  
  
  
  <pre><code>function constructContentPane(methodToBeCalled){
          var testCntPane=new dojox.layout.ContentPane({
                      href: "some url",
                      executeScripts: true,
                      cleanContent: true,
                      onDownloadEnd: methodToBeCalled
                  }).placeAt("testContentPaneId");
           testCntPane.startup();
  }
  </code></pre>
  
  <p>This places the content pane inside <code>testContentPaneId</code> and calls <code>methodToBeCalled</code> method once the content pane is created.</p>
  
  <p>I have two questions.</p>
  
  <ol>
  <li>How do I check if the content pane is already created or not? I tried to check using the code below</li>
  </ol>
  
  
  
  <pre><code>if(dijit.byId("testContentPaneId") == undefined) {
      //then don't create again
  }
  </code></pre>
  
  <p>But this did not work. Each time it creates the content pane with the id <code>dojox_layout_ContentPane_0</code>. The last digit gets incremented each time.</p>
  
  <ol start="2">
  <li>Is this the right way to pass the <code>onComplete</code> method as argument? This is how I invoke this</li>
  </ol>
  
  
  
  <pre><code>constructContentPane(thisMethodWillBeCalled);
  </code></pre>
  
  <p>Is there any better way to do this? How do I invoke that method? I tried using <code>eval(methodToBeCalled)</code>, but that did not work.</p>