Maintain variable when dynamic LinkButton is clicked
<p>I stripped down my solution so that I can understand why this is not working. Hopefully, someone can help.</p>

<p>There is only one placeholder control on the aspx page:</p>

<pre><code>&lt;asp:PlaceHolder ID="Placeholder1" runat="server" /&gt;
</code></pre>

<p>On the code behind, I am setting a variable called <strong>test</strong> and on Page_Load, changing the variable to something else.  How come, when I click the dynamically added LinkButton, the <strong>test</strong> variable is not maintaining it's state:</p>

<pre><code>    public string test = "Hello";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Response.Write(test + "&lt;br /&gt;");  //test = "Hello"
            test = "Hello World!";
            Response.Write(test + "&lt;br /&gt;");  //test = "Hello World!"
        }
        Placeholder1.Controls.Clear();
        CreateDynamicControl();
    }

    private void CreateDynamicControl()
    {
        LinkButton lnk = new LinkButton();
        lnk.Click += new EventHandler(lbl_Click);
        lnk.Text = "TEST LinkButton";
        Placeholder1.Controls.Add(lnk);
    }

    void lbl_Click(object sender, EventArgs e)
    {
        LinkButton lnk = sender as LinkButton;
        Response.Write("lbl_Click: " + test + "&lt;br /&gt;");
    }
</code></pre>
