Trying to figure out how to share a variable between .net code behind subs
<p>I am trying to figure out how to set the ID variable in the <code>itemCommand</code> block, and then share it in the <code>PagePropertiesChanged</code> block.</p>

<p>I am wondering if this is possible to do?</p>

<p>Here is a simplified example of what I am trying to do,</p>

<pre><code>Public Shared ID As Integer

 Private Sub DataListCategories_ItemCommand(source As Object, e As DataListCommandEventArgs) Handles DataListCategories.ItemCommand

    If (e.CommandName.Equals("ClickCategory")) Then

            ID = e.CommandArgument

    End if

 End sub

 Private Sub ListViewGallery_PagePropertiesChanged(sender As Object, e As EventArgs) Handles ListViewGallery.PagePropertiesChanged


    Me.ListViewGallery.DataSource = Dal.GetPhotographyByCategory(ID)
        Me.ListViewGallery.DataBind()

 End Sub
</code></pre>