<%@ Page Language="VB"%>
<script runat="server">
Sub tbMessage_Change(Sender as Object, E as EventArgs)
lblMessage.text = "Hello " + tbMessage.text
End Sub
</script>
<HTML>
<body>
<font size="5">Sam's Teach Yourself ASP.NET in 21 Days: Day 2 </font>
<hr>
<p>
<% Response.Write("Our First Page<p>") %>
<form runat="server">
Please enter your name:
<asp:TextBox ID="tbMessage" OnTextChanged="tbMessage_Change" runat=server />
<asp:Button ID="btSubmit" Text="Submit" runat=server /><p>
<asp:Label ID="lblMessage" Font-Size="20pt" runat=server />
</form>
</p>
</body>
</HTML>
I have obtained this piece of code from some book, and would like to ask some questions. During run-time, based on my understanding, please correct me if I am wrong, as I type text into the textbox, the TextChanged Event is fired.
Based on the above code, as the letters are typed consecutively into the textbox, the letters should also be consecutively reflected in the lblMessage label. But somehow, the label only displays the message after I press the Submit button.
Furthermore, I do not see any code here which links the submit button to the tbMessage_change procedure. Could someone please clarify the situation to me?