title: Is there any way to replace Response.Write?
body: <p>My problem is, I have the following function:</p>
  <pre><code>function change_tarif(param) {
      var arrTarif = &lt;% Response.Write(Session[&quot;Tarif&quot;]); %&gt;
      .....
  }
  </code></pre>
  <p>Session[&quot;Tarif&quot;] - contains multidimensional array List and when I'm loading my page it's giving this Error that</p>
  <p>The Controls collection cannot be modified because the control contains code blocks (i.e. <code>&lt;% ... %&gt;</code>).</p>
  <p>When I delete <code>&lt;% Response.Write(Session[&quot;Tarif&quot;]); %&gt;</code> it doesn't give this error. So, how can I replace this code to get array List from Session[&quot;Tarif&quot;] without using the code blocks <code>&lt;% %&gt;</code>?</p>
  <p>This is my Array List code in C#:</p>
  <pre><code>    public void getTarifList()
  {
      int intRows = 0;
      string strTarif = &quot;null&quot;;
      Session[&quot;Tarif&quot;] = &quot;null&quot;;
  
      SqlCommand cmdTarif = new SqlCommand(&quot;sp_SIMPay_GetTarifList&quot;);
      cmdTarif.CommandType = CommandType.StoredProcedure;
  
      DataTable dtTarif = SQL.GetData(cmdTarif);
  
      if (dtTarif.Rows.Count &gt; 0)
      {
          intRows = dtTarif.Rows.Count;
  
          strTarif = &quot;new Array(&quot; + intRows + &quot;);&quot;;
          int intIndex = 0;
  
          foreach (DataRow dRows in dtTarif.Rows)
          {
              strTarif += &quot;arrTarif[&quot; + intIndex + &quot;] = new Array('&quot; + dRows[&quot;TarifName&quot;] + &quot;', '&quot; + dRows[&quot;ProviderID&quot;] + &quot;', '&quot; + dRows[&quot;CodeID&quot;] + &quot;');&quot;;
              intIndex++;
          }
      }
      else
      {
          strTarif = &quot;null&quot;;
      }
      Session[&quot;Tarif&quot;] = strTarif;
  }
  </code></pre>
  <p>My full script:</p>
  <pre><code>function change_tarif(param) {
  var  arrTarif = &lt;% Response.Write(Session[&quot;Tarif&quot;]); %&gt;
  var select = document.getElementById('TarifList');
  
  
  var i = 0;
  
  if (arrTarif != null) {
      for (i = 0; i &lt; arrTarif.length; i++) {
          if (arrTarif[i][1] == '98' &amp;&amp; param == '98') {
              clear_tarif();
              select.options[select.options.length] = new Option('' + arrTarif[i][0] + '', '' + arrTarif[i][2] + '');
              break;
          }
          else {
              clear_tarif();
              select.options[select.options.length] = new Option('Default Tarif', '');
          }
      }
  }
  }
  </code></pre>