If you want to raise a server event for every key press, the page will
be reloaded for every key that you press, which is not very practical.
For something simple like displaying some text on the page, you should
use a client event instead, i.e. Javascript.
Example:
onkeydown="document.getElementById('ElementForShowingMessage').innerHTML='message';"
Hello,
that is to set the text of a control Ok, but my situation is a little
more complicated than that ... allow me to explain what I really try
to implement.
I am creating a simple calculator to add 2 values.
For the user to enter a value, I have created a web user control
consisting of a textbox and some additional logic.
I add 2 of those webuser control on an asp.net form, one for each
value.
added as well ON THE FORM (and not in the user control) are a button
(Add) and a label to display the result
Now, i run it ... enter 2 values, press Add and the result is
displayed in the label ... easy.
But what i want now is that when I change one of the values in one of
the textboxes in the user control (during 'onkeypress' in javascript)
is that the text in the label control is cleared.
for this to happen, I can not just implement it in the onkeypress of
the textbox, since the label control is not part of the user control
you see?
so what I need, I think, is to raise some event in onkeypress (in the
webuser control) and implement the event handler in the host form but
whithout a postback to the server !
any ideas?
Chris