G
Guest
Hello,
I was looking at this sample asp page:
-----------------------------------
<Script Runat="Server">
Sub Page_Load
lblMessage.Text = ""
End Sub
Sub txtSomeText_TextChanged( s As Object, e As EventArgs )
lblMessage.Text = "You changed the value!"
End Sub
</Script>
<html>
<head><title>TextBoxChanged.aspx</title></head>
<body>
<form Runat="Server">
<asp:TextBox
ID="txtSomeText"
Text="Apple"
OnTextChanged="txtSomeText_TextChanged"
Runat="Server"/>
<asp:Button
Text="Submit!"
Runat="Server"/>
<p>
<asp:Label
id="lblMessage"
Runat="Server" />
</form>
</body>
</html>
-----------------------------------
The text that goes along with this sample says that you need to clear the
text of the text box on page load or else it will always say "You changed the
value!" even if you didn't (due to viewsate).
My question is, why doesn't the page load event trigger the text box's
TextChanged event? You are changing the text box's text.
Thanks,
-Flack
I was looking at this sample asp page:
-----------------------------------
<Script Runat="Server">
Sub Page_Load
lblMessage.Text = ""
End Sub
Sub txtSomeText_TextChanged( s As Object, e As EventArgs )
lblMessage.Text = "You changed the value!"
End Sub
</Script>
<html>
<head><title>TextBoxChanged.aspx</title></head>
<body>
<form Runat="Server">
<asp:TextBox
ID="txtSomeText"
Text="Apple"
OnTextChanged="txtSomeText_TextChanged"
Runat="Server"/>
<asp:Button
Text="Submit!"
Runat="Server"/>
<p>
<asp:Label
id="lblMessage"
Runat="Server" />
</form>
</body>
</html>
-----------------------------------
The text that goes along with this sample says that you need to clear the
text of the text box on page load or else it will always say "You changed the
value!" even if you didn't (due to viewsate).
My question is, why doesn't the page load event trigger the text box's
TextChanged event? You are changing the text box's text.
Thanks,
-Flack