PHP Code:
<script language="c#" runat="server">
protected override void OnInit(System.EventArgs e)
{
//You must create the controls here every time! otherwise
//the page will "forget" them. If they are created in the same
//order every time they will also maintain their viewstate on postback.
TextBox txtFirstName = new TextBox();
txtFirstName.ID = "txtFirstName";
txtFirstName.AutoPostBack = true;
txtFirstName.TextChanged += new System.EventHandler(txtFirstName_TextChanged);
FormMain.Controls.Add(txtFirstName);
Button btnSubmit = new Button();
btnSubmit.Text = "Submit!";
btnSubmit.ID = "btnSubmit";
btnSubmit.Click += new System.EventHandler(btnSubmit_Clicked);
FormMain.Controls.Add(btnSubmit);
}
protected void txtFirstName_TextChanged(object sender, System.EventArgs e)
{
//This only fires when the text has been altered and focus leaves
//the text box(i.e. you need to tab out of the text box for this event to fire)
Response.Write("Text Changed!");
}
protected void btnSubmit_Clicked(object sender, System.EventArgs e)
{
Response.Write("Submit Clicked!");
}
</script>
<html>
<body>
<form runat="server" id="FormMain">
</form>
</body>
</html>