title: Javascript variable not found
body: <p>i have the script on ASPX: </p>
  
  <pre><code>&lt;dx:ASPxButton ID="ASPxButton_PrintLetrVoit" runat="server" Text="Impression lettre de voiture(décalage)" AutoPostBack="False"&gt;
        &lt;ClientSideEvents Click="function (s, e) { e.processOnServer = false; for (var i = 0; i &lt; Tourne.length; i++) {window.open('PrintLettreVoit.aspx?TourneId='+Tourne[i]);}}" /&gt;
  &lt;/dx:ASPxButton&gt;
  </code></pre>
  
  <p>and in cs :</p>
  
  <pre><code>public List&lt;string&gt; Tourne;
  
  protected void Page_Load(object sender, EventArgs e)
  {
        try
        {
            foreach (var oItem in oOrdre_BL.GetAllLettrVoit_Tourne())
            {
             Page.ClientScript.RegisterArrayDeclaration("Tourne", "'"+oItem+"'");
            }
        ......
  </code></pre>
  
  <p>unfortunately i got Error on javascript:
  i got error:</p>
  
  <pre><code>Horodatage : 06/09/2012 11:23:03
  Erreur : ReferenceError: Tourne is not defined
  Fichier Source : http://xxxxxxx/Code/BackEnd/FaExped_BackEnd_WebSite/Ordre.aspx
  Ligne : 5146
  </code></pre>
  
  <p>any idea ?</p>
  
  <p>Thanks you in advance</p>
  
  <p>PS: when i see the source code that generated:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
  var Tourne =  new Array('');
  //]]&gt;
  &lt;/script&gt;
  
  
  &lt;script type="text/javascript"&gt;
  //&lt;![CDATA[
  
  WebForm_InitCallback();//]]&gt;
  &lt;/script&gt;
  &lt;/form&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>i have modified my code:</p>
  
  <pre><code> &lt;dx:ASPxButton ID="ASPxButton_PrintLetrVoit" runat="server" Text="Impression lettre de voiture(décalage)" AutoPostBack="False"&gt;
                            &lt;ClientSideEvents Click="function (s, e) {   
                            if(typeof(Tourne) !== 'undefined' &amp;&amp; Tourne != null) 
                            {
                              e.processOnServer = false; 
  
                               for (var i = 0; i &lt; Tourne.length; i++) {window.open('PrintLettreVoit.aspx?TourneId='+Tourne[i]);}
                            }
                            else
                            {alert ('Tous est coches');}
  
                               }" /&gt;
                          &lt;/dx:ASPxButton&gt;
  </code></pre>
  
  <p>but still, it is not a good solution, because i don't know why Tourne is undefined?</p>