Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Regarding Events


Message #1 by "SATHISH C.G." <cgs@s...> on Sat, 9 Dec 2000 12:46:31 +0530
How can i trap the onkeypress event of an server side text box ? I tried 

with the following code.



<script language=vb runat="Server">

Sub press(Sender as Object,E as EventArgs)



End Sub

</script>

<form runat=3D"server">

<input type=3Dtext id=3D"txt1" runat=3D"server" OnkeyPress=3D"Press"/>

</form>



 When i raise that event by pressing a key in the text box an runtime 

error flashes stating cannot find the specifed method(Press).



Please mail me the exact syntax to handle the keypress event.



Regards



SATHISH C.G.



Message #2 by "Fredrik Normen" <fredrik.normen@e...> on Sat, 09 Dec 2000 14:05:44 +0100
You can=27t trap the onkeypress event of an server side text box and try 



to call a function with the runat=3Dserver attribute=2E=2E This must be m

ade 



on the client=2C for example with Java Script=2E



/Fredrik Norm=E9n







----- Original Message -----

From=3A =22SATHISH C=2EG=2E=22 =3Ccgs=40srasys=2Eco=2Ein=3E

Date=3A Saturday=2C December 9=2C 2000 8=3A16 am

Subject=3A =5Baspx=5D Regarding Events



=3E How can i trap the onkeypress event of an server side text box =3F I 



=3E tried 



=3E with the following code=2E

=3E 



=3E =3Cscript language=3Dvb runat=3D=22Server=22=3E

=3E Sub press(Sender as Object=2CE as EventArgs)

=3E 



=3E End Sub

=3E =3C/script=3E

=3E =3Cform runat=3D3D=22server=22=3E

=3E =3Cinput type=3D3Dtext id=3D3D=22txt1=22 runat=3D3D=22server=22 Onkey

Press=3D3D=22Press=22/=3E

=3E =3C/form=3E

=3E 



=3E When i raise that event by pressing a key in the text box an 



=3E runtime 



=3E error flashes stating cannot find the specifed method(Press)=2E

=3E 



=3E Please mail me the exact syntax to handle the keypress event=2E

=3E 



=3E Regards

=3E 



=3E SATHISH C=2EG=2E

=3E 



=3E 



=3E ---

=3E You are currently subscribed to aspx as=3A fredrik=2Enormen=40endero=2E

com

=3E To unsubscribe send a blank email to leave-aspx-18463N=40p2p=2Ewrox=2E

com

=3E 



=3E 



Message #3 by Susan Warren <swarren@m...> on Sat, 9 Dec 2000 08:34:07 -0800
Sathish,



OnKeyPress is a *client* side event in the browser, and the function that

handles it ("Press" in your case) needs to be in client script in a

client-side script block.  If this is already working for you, adding

runat="server" to your input tag should not change this.



Your example shows trying to handle the keypress on the server, which is not

supported.



hth,

Susan





-----Original Message-----

From: SATHISH C.G. [mailto:cgs@s...]

Sent: Friday, December 08, 2000 11:17 PM

To: ASP+

Subject: [aspx] Regarding Events





How can i trap the onkeypress event of an server side text box ? I tried 

with the following code.



<script language=vb runat="Server">

Sub press(Sender as Object,E as EventArgs)



End Sub

</script>

<form runat=3D"server">

<input type=3Dtext id=3D"txt1" runat=3D"server" OnkeyPress=3D"Press"/>

</form>



 When i raise that event by pressing a key in the text box an runtime 

error flashes stating cannot find the specifed method(Press).



Please mail me the exact syntax to handle the keypress event.



Regards



SATHISH C.G.



Message #4 by "SATHISH C.G." <cgs@s...> on Mon, 11 Dec 2000 11:30:18 +0530
Hai,



Hi,



     Thanks for the solution.But what about the OnKeypressEventArgs Object.

Can we pass the object in the event handler to get the key code or we have

to use the traditional way (WIndow.Event.KeyCode).



regards



SATHISH C.G.





-----Original Message-----

From: Fredrik Normen <fredrik.normen@e...>

To: ASP+ <aspx@p...>

Date: Saturday, December 09, 2000 6:58 PM

Subject: [aspx] Re: Regarding Events





You can't trap the onkeypress event of an server side text box and try

to call a function with the runat=server attribute.. This must be made

on the client, for example with Java Script.



/Fredrik Normén







----- Original Message -----

From: "SATHISH C.G." <cgs@s...>

Date: Saturday, December 9, 2000 8:16 am

Subject: [aspx] Regarding Events



> How can i trap the onkeypress event of an server side text box ? I

> tried

> with the following code.

>

> <script language=vb runat="Server">

> Sub press(Sender as Object,E as EventArgs)

>

> End Sub

> </script>

> <form runat=3D"server">

> <input type=3Dtext id=3D"txt1" runat=3D"server" OnkeyPress=3D"Press"/>

> </form>

>

> When i raise that event by pressing a key in the text box an

> runtime

> error flashes stating cannot find the specifed method(Press).

>

> Please mail me the exact syntax to handle the keypress event.

>

> Regards

>

> SATHISH C.G.

>

>

Message #5 by Susan Warren <swarren@m...> on Mon, 11 Dec 2000 02:18:23 -0800
Sathish,



The KeyPressEventArgs class is part of the Windows Forms forms package

framework (you'll note it's in the System.WinForms namespace), not part of

ASP.NET.  Processing for .NET classes in an ASP.NET form takes place on the

server -- it has to, in order to work with Web clients that don't have .NET

installed on them.  



If you are creating a traditional client application, and .NET will be

installed on the client, then you should check out Windows Forms.  



hth,

Susan



-----Original Message-----

From: SATHISH C.G. [mailto:cgs@s...]

Sent: Sunday, December 10, 2000 10:00 PM

To: ASP+

Subject: [aspx] Re: Regarding Events





Hai,



Hi,



     Thanks for the solution.But what about the OnKeypressEventArgs Object.

Can we pass the object in the event handler to get the key code or we have

to use the traditional way (WIndow.Event.KeyCode).



regards



SATHISH C.G.





-----Original Message-----

From: Fredrik Normen <fredrik.normen@e...>

To: ASP+ <aspx@p...>

Date: Saturday, December 09, 2000 6:58 PM

Subject: [aspx] Re: Regarding Events





You can't trap the onkeypress event of an server side text box and try

to call a function with the runat=server attribute.. This must be made

on the client, for example with Java Script.



/Fredrik Normen







----- Original Message -----

From: "SATHISH C.G." <cgs@s...>

Date: Saturday, December 9, 2000 8:16 am

Subject: [aspx] Regarding Events



> How can i trap the onkeypress event of an server side text box ? I

> tried

> with the following code.

>

> <script language=vb runat="Server">

> Sub press(Sender as Object,E as EventArgs)

>

> End Sub

> </script>

> <form runat=3D"server">

> <input type=3Dtext id=3D"txt1" runat=3D"server" OnkeyPress=3D"Press"/>

> </form>

>

> When i raise that event by pressing a key in the text box an

> runtime

> error flashes stating cannot find the specifed method(Press).

>

> Please mail me the exact syntax to handle the keypress event.

>

> Regards

>

> SATHISH C.G.

>

>



Message #6 by =?iso-8859-1?Q?Fredrik_Norm=E9n?= <fredrik.normen@e...> on Mon, 11 Dec 2000 10:21:24 +0100
You mean KeyPressEventArgs ?

You can use the KeyChar property of the KeyPressEventArgs, it return the

character corresponding to the key pressed.



This will work only for Windows Forms.



Here is an example:



Public Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As

System.WinForms.KeyPressEventArgs) Handles TextBox1.KeyPress

        MessageBox.show(e.KeyChar())

End Sub



/Fredrik Normén



-----Original Message-----

From: SATHISH C.G. [mailto:cgs@s...]

Sent: den 11 december 2000 07:00

To: ASP+

Subject: [aspx] Re: Regarding Events





Hai,



Hi,



     Thanks for the solution.But what about the OnKeypressEventArgs Object.

Can we pass the object in the event handler to get the key code or we have

to use the traditional way (WIndow.Event.KeyCode).



regards



SATHISH C.G.





-----Original Message-----

From: Fredrik Normen <fredrik.normen@e...>

To: ASP+ <aspx@p...>

Date: Saturday, December 09, 2000 6:58 PM

Subject: [aspx] Re: Regarding Events





You can't trap the onkeypress event of an server side text box and try

to call a function with the runat=server attribute.. This must be made

on the client, for example with Java Script.



/Fredrik Normén







----- Original Message -----

From: "SATHISH C.G." <cgs@s...>

Date: Saturday, December 9, 2000 8:16 am

Subject: [aspx] Regarding Events



> How can i trap the onkeypress event of an server side text box ? I

> tried

> with the following code.

>

> <script language=vb runat="Server">

> Sub press(Sender as Object,E as EventArgs)

>

> End Sub

> </script>

> <form runat=3D"server">

> <input type=3Dtext id=3D"txt1" runat=3D"server" OnkeyPress=3D"Press"/>

> </form>

>

> When i raise that event by pressing a key in the text box an

> runtime

> error flashes stating cannot find the specifed method(Press).

>

> Please mail me the exact syntax to handle the keypress event.

>

> Regards

>

> SATHISH C.G.

>

>



Message #7 by "SATHISH C.G." <cgs@s...> on Mon, 11 Dec 2000 18:19:19 +0530
Hi,



    Can we use windows form controls in a .aspx page. Can we use functions

like msgbox.show in a .aspx file. Please tell me the exact difference

between win forms and web forms.



-----Original Message-----

From: Susan Warren <swarren@m...>

To: ASP+ <aspx@p...>

Date: Monday, December 11, 2000 5:14 PM

Subject: [aspx] Re: Regarding Events





>Sathish,

>

>The KeyPressEventArgs class is part of the Windows Forms forms package

>framework (you'll note it's in the System.WinForms namespace), not part of

>ASP.NET.  Processing for .NET classes in an ASP.NET form takes place on the

>server -- it has to, in order to work with Web clients that don't have .NET

>installed on them.

>

>If you are creating a traditional client application, and .NET will be

>installed on the client, then you should check out Windows Forms.

>

>hth,

>Susan

>

>-----Original Message-----

>From: SATHISH C.G. [mailto:cgs@s...]

>Sent: Sunday, December 10, 2000 10:00 PM

>To: ASP+

>Subject: [aspx] Re: Regarding Events

>

>

>Hai,

>

>Hi,

>

>     Thanks for the solution.But what about the OnKeypressEventArgs Object.

>Can we pass the object in the event handler to get the key code or we have

>to use the traditional way (WIndow.Event.KeyCode).

>

>regards

>

>SATHISH C.G.

>

>

>-----Original Message-----

>From: Fredrik Normen <fredrik.normen@e...>

>To: ASP+ <aspx@p...>

>Date: Saturday, December 09, 2000 6:58 PM

>Subject: [aspx] Re: Regarding Events

>

>

>You can't trap the onkeypress event of an server side text box and try

>to call a function with the runat=server attribute.. This must be made

>on the client, for example with Java Script.

>

>/Fredrik Normen

>

>

>

>----- Original Message -----

>From: "SATHISH C.G." <cgs@s...>

>Date: Saturday, December 9, 2000 8:16 am

>Subject: [aspx] Regarding Events

>

>> How can i trap the onkeypress event of an server side text box ? I

>> tried

>> with the following code.

>>

>> <script language=vb runat="Server">

>> Sub press(Sender as Object,E as EventArgs)

>>

>> End Sub

>> </script>

>> <form runat=3D"server">

>> <input type=3Dtext id=3D"txt1" runat=3D"server" OnkeyPress=3D"Press"/>

>> </form>

>>

>> When i raise that event by pressing a key in the text box an

>> runtime

>> error flashes stating cannot find the specifed method(Press).

>>

>> Please mail me the exact syntax to handle the keypress event.

>>

>> Regards

>>

>> SATHISH C.G.

>>

>>

>

>

Message #8 by Richard Conway <ranger_conway@y...> on Mon, 11 Dec 2000 09:26:25 -0800 (PST)
Win forms is an object model for windows which sits on

top of NGWS which sits on top of Win API etc.

Web forms are essentially a suite of objects enabling

HTML output which the browser can interpret. Such that

somebody can write a web control and package it up

using it anywhere within an NGWS environment (in an

ASP.NET context). This introduces the idea of

component reusability with respect to the web. The

outout of which will always be HTML (currently HTML

3.2). 



Regards,

Richard

--- "SATHISH C.G." <cgs@s...> wrote:

> Hi,

> 

>     Can we use windows form controls in a .aspx

> page. Can we use functions

> like msgbox.show in a .aspx file. Please tell me the

> exact difference

> between win forms and web forms.

> 

> -----Original Message-----

> From: Susan Warren <swarren@m...>

> To: ASP+ <aspx@p...>

> Date: Monday, December 11, 2000 5:14 PM

> Subject: [aspx] Re: Regarding Events

> 

> 

> >Sathish,

> >

> >The KeyPressEventArgs class is part of the Windows

> Forms forms package

> >framework (you'll note it's in the System.WinForms

> namespace), not part of

> >ASP.NET.  Processing for .NET classes in an ASP.NET

> form takes place on the

> >server -- it has to, in order to work with Web

> clients that don't have .NET

> >installed on them.

> >

> >If you are creating a traditional client

> application, and .NET will be

> >installed on the client, then you should check out

> Windows Forms.

> >

> >hth,

> >Susan

> >

> >-----Original Message-----

> >From: SATHISH C.G. [mailto:cgs@s...]

> >Sent: Sunday, December 10, 2000 10:00 PM

> >To: ASP+

> >Subject: [aspx] Re: Regarding Events

> >

> >

> >Hai,

> >

> >Hi,

> >

> >     Thanks for the solution.But what about the

> OnKeypressEventArgs Object.

> >Can we pass the object in the event handler to get

> the key code or we have

> >to use the traditional way (WIndow.Event.KeyCode).

> >

> >regards

> >

> >SATHISH C.G.

> >

> >

> >-----Original Message-----

> >From: Fredrik Normen <fredrik.normen@e...>

> >To: ASP+ <aspx@p...>

> >Date: Saturday, December 09, 2000 6:58 PM

> >Subject: [aspx] Re: Regarding Events

> >

> >

> >You can't trap the onkeypress event of an server

> side text box and try

> >to call a function with the runat=server

> attribute.. This must be made

> >on the client, for example with Java Script.

> >

> >/Fredrik Normen

> >

> >

> >

> >----- Original Message -----

> >From: "SATHISH C.G." <cgs@s...>

> >Date: Saturday, December 9, 2000 8:16 am

> >Subject: [aspx] Regarding Events

> >

> >> How can i trap the onkeypress event of an server

> side text box ? I

> >> tried

> >> with the following code.

> >>

> >> <script language=vb runat="Server">

> >> Sub press(Sender as Object,E as EventArgs)

> >>

> >> End Sub

> >> </script>

> >> <form runat=3D"server">

> >> <input type=3Dtext id=3D"txt1" runat=3D"server"

> OnkeyPress=3D"Press"/>

> >> </form>

> >>

> >> When i raise that event by pressing a key in the

> text box an

> >> runtime

> >> error flashes stating cannot find the specifed

> method(Press).

> >>

> >> Please mail me the exact syntax to handle the

> keypress event.

> >>

> >> Regards

> >>

> >> SATHISH C.G.

> >>

> >>

> >

> >

> 


  Return to Index