Thursday, March 29, 2012

server side kepress event on textbox

HI There,

I have a webform and I am wanting to call a function from a textbox control
located on the webform when a key is pressed. Can this be done in server side.
already know do like this

on ASPX page within javascript tags
<script laguage=javascript>
function trapKeypress() {
alert (window.event.keyCode);
}
</script
and in .vb page of the .aspx page ..'
textbox1.attributes.item("onkeypress") = "javascript:trapKeypress();"

Can I do it without using JavaScript .

RegardsYou can submit the form in trapKeypress(). This will cause a postback and
you can pass to the server a sort of info telling what exactly caused the
postback. This will resemble a server event. You can't avoid using
javascript on the client side. How can server know what is happening in the
browser?

Eliyahu

"Raed Sawalha" <RaedSawalha@.discussions.microsoft.com> wrote in message
news:1D18DAD2-5F54-4F85-8E27-8F63BB1F3B7E@.microsoft.com...
> HI There,
> I have a webform and I am wanting to call a function from a textbox
control
> located on the webform when a key is pressed. Can this be done in server
side.
> already know do like this
> on ASPX page within javascript tags
> <script laguage=javascript>
> function trapKeypress() {
> alert (window.event.keyCode);
> }
> </script>
> and in .vb page of the .aspx page ..'
> textbox1.attributes.item("onkeypress") = "javascript:trapKeypress();"
> Can I do it without using JavaScript .
> Regards

0 comments:

Post a Comment