title: How to define a global Array of string on web page level
body: <p>I defined a global array of <code>String</code> and I use it in on click event for 2 buttons.</p>
  
  <pre><code>Dim arrPoliciesNumber() As String = New String() {}
  </code></pre>
  
  <p>and in first button click event i inserted the values in the array</p>
  
  <pre><code>Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
   If MultipleData.Value &lt;&gt; "" Then
  
          Dim _Data = MultipleData.Value.Split(vbLf)
          arrPoliciesNumber = MultipleData.Value.Split(vbLf)
          For Each _Text In _Data
  
              _SearchList1Value = _SearchList1Value + _Text.Trim + "','"
  
          Next
          _SearchList1Value = Left(_SearchList1Value, _SearchList1Value.Length - 3)
  
          _SearchList1Value = "'" + _SearchList1Value + "'"
  
      Else
          If txtSearch1.Text.Trim &lt;&gt; "" Then
              _SearchList1Value = txtSearch1.Text
              arrPoliciesNumber = New String(0) {}
              arrPoliciesNumber(0) = New String(txtSearch1.Text)
              _SearchList1Value = "'" + _SearchList1Value + "'"
          End If
  
      End If
  </code></pre>
  
  <p>now on another button click event i tried to get the inserted string in the array but i found it empty with Length = 0</p>
  
  <pre><code> If arrPoliciesNumber.Length &gt; 0 Then
          'here we need to add the report parameter with report ID
  
          For Each policyNo As String In arrPoliciesNumber
              _DB.AddReportRequestParameter(reportId, policyNo)
          Next
  
      End If
  </code></pre>
  
  <p>how i can keep the inserted values in the array ? Thanks in advance.</p>