c# asp Textbox Text does only change from Code behind when Textbox is readonly
<p>I'm absolutliy confused.
I try to Change the default Text for a Textbox.</p>

<p>Here a simple Code to reproduce the Problem.</p>

<p>TextBox Textbox1 and the label become updated on any click to the Button.
Textbox var will never get updated. Only on first PageLoad.</p>

<p>The Problem is, I have to add my Textboxes from Code behind and not in aspx Page.</p>

<p>Any Ideas whats going on and how I can get it working?</p>

<pre><code>%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="tbtester.WebForm1" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head runat="server"&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;form id="form1" runat="server"&gt;
    &lt;div &gt;

        &lt;asp:Panel ID="mypanel" runat="server"&gt;
            &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
            &lt;asp:Button ID="Button1" runat="server" Text="Button" /&gt;
            &lt;/asp:Panel&gt;
    &lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

    namespace tbtester
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                System.Web.UI.WebControls.TextBox var = new System.Web.UI.WebControls.TextBox();
                //if (!this.Page.IsPostBack)
                Label test = new Label();

                mypanel.Controls.Add(test);
                mypanel.Controls.Add(var);

                var.Text = DateTime.Now.ToLongTimeString();
                test.Text = DateTime.Now.ToLongTimeString();

                var.ReadOnly = false;

                TextBox1.Text = DateTime.Now.ToLongTimeString();



            }
        }
    }
</code></pre>
