I've used these codes in my aspx document

<script runat="server">
Sub change(sender As Object, e As EventArgs)
lbl1.Text="You changed text to " & txt1.Text
End Sub
And inside the HTML <body> tag I used this...
<form runat="server">
Change text
<asp:TextBox id="txt1" runat="server"
text="Hello World!" ontextchanged="change" autopostback="true"/>
<p><asp:Label id="lbl1" runat="server" /></p>

Now my question is when I am opening a browser, I get to see Hello World! in the text box.
And since I've used change(), should it not be changing the output as the user is inputing text into the textbox. It only changes once after the textbox looses its focus i.e., when clicked anywhere outside the textbox. I mean there is lack of dynamism may be.....

I hope I've succceeded in explaining my problem.

8 Years
Discussion Span
Last Post by majestic0110

I see you have got that from W3schools hehe I am not sure why it is not working will investigate and get back to you when I can...


Ahhh when the user hits enter the text DOES change. So it will work, with regards to the dynamism that you speak of do you want the label text to change as a user inputs text in the textbox?


yeah u knw wen a user is inputing some text in the textbox the chang sun routine should fire changing the text in the lebel, dont u agree to me?

by the way thanx


I am not sure if this is possible without some client side scripting (not my strong point) due to the requirement of a postback on the page. Will look into this further...


Well buddy I'll see it. I've taken down the codes. After checking I'll imform u.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.