473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Event Driven in ASP.NET (Code Behind in VB.NET)

Dear All,

Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say there is
a code (user input). Once he enters the code in the lost focus event I need
to display the name.
Nov 21 '05 #1
6 4429
Hi Peri,

Web applications work differently than desktop apps and most events fired on
the client are not pushed all the way to the server - only a few are -
typically submit actions like Click events or change events on things like
lists. Most other common UI events just fire on the client and must be
handled with client side JavaScript.

You can't really do this with a Web app, unless you handle the appropriate
events in client JavaScript code (ie. onclick, onblur, onchange etc.). You
need to write script code to handle these events which are client side
events and not ASP.NET events. If you want to get really tricky you can
forward those events to the server using AJAX style messages but this is not
automatic by any stretch of the imagination.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com
www.west-wind.com/weblog
"Peri" <lp***@CSPL.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Dear All,

Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say there
is
a code (user input). Once he enters the code in the lost focus event I
need
to display the name.

Nov 21 '05 #2
I think you'd be best off using client side code for this kind of thing,
since a quick response precludes posting back after each individual event is
fired.

Here are some examples of adding client side code to your web controls:
http://SteveOrr.net/articles/ClientSideSuite.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Peri" <lp***@CSPL.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Dear All,

Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say there
is
a code (user input). Once he enters the code in the lost focus event I
need
to display the name.

Nov 21 '05 #3
"Peri" <lp***@CSPL.com> wrote in
news:Oc**************@TK2MSFTNGP09.phx.gbl:
Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say
there is a code (user input). Once he enters the code in the lost
focus event I need to display the name.


This sort of stuff can be done with Javascript + ASP.NET 2.0's client side
callbacks. If you want to do it in ASP.NET 1.1 take a look at Dart's
livecontrols or AshelyIT's (generic) and Thycotic Javascript Remoting for
ASP.NET.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 21 '05 #4
Rick,

Will you enlighten me, where can Ajax help me in this?

Cor
Nov 21 '05 #5
Rick,
Will you enlighten me, where can Ajax help me in this?

I mean seriously help me in a way that the client can type text in a textbox
using a normal tempo.

Cor
Nov 21 '05 #6
Thanks for all your replies.

--
Thanks and Regards,

Peri
"Peri" <lp***@CSPL.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
Dear All,

Can anyone help me out to write event driven code in ASP.NET. That is

1. How do I get a Keypress event in a text box (or a control).
2. How do I get a Lostfocus event in a text box (or a control) Say there is a code (user input). Once he enters the code in the lost focus event I need to display the name.

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: alanrn | last post by:
For all you seasoned VB programmers this is going to be a no brainer. However, as a C programmer learning VB I'm having trouble getting my arms around the event-driven nature of VB. Suppose I...
1
by: Daniel Bass | last post by:
hey guys. overview --------- I'm designing a messaging system that works on the principle of late binding to the I/O objects, depending on the .Net class libraries present in the local folder....
37
by: Alan Silver | last post by:
Hello, Newbie here, so please forgive what is probably a basic question ... I see a lot of discussion about "code behind", which if I have understood correctly, means that the script code goes...
4
by: David Jones | last post by:
I have some code repeated in many page_load methods in an ASP.NET app. I have buttons that are enabled or disbaled depending upon the state of a variable in the session. Is there a way to put that...
6
by: Peri | last post by:
Dear All, Can anyone help me out to write event driven code in ASP.NET. That is 1. How do I get a Keypress event in a text box (or a control). 2. How do I get a Lostfocus event in a text box...
3
by: Shawn | last post by:
I have a DataGrid with only one TemplateColumn wich contains a DropDownList. After I bind the DataGrid I fill the dropDownLists with values in ItemDataBound. None of the DropDownLists contains the...
1
by: archana | last post by:
Hi all, I am new to asp.net. I have one question regarding code- behind model. I have written page_load event in code behind as well as in aspx page. Means i am doing mixing of code-behind...
1
by: aawhan | last post by:
I have a master page and a content page in my web page(.net 2008).In the master page i am having some menus.Now after doing some operation in the page if i will click to any other menu then it should...
8
by: Brad Walton | last post by:
Hello. First post, but been doing a bit of reading here. I am working on a project in Java, but decided to switch over to C# after seeing some of the additional features I can get from C#. One of...
1
by: varunkumarid | last post by:
Hi to All, I have created the button in client side. When the user going to click the button how can i get the event in code behind? Here is my javascript code. function...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.