473,714 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

event mechanism behaves in unexpected way.

Hi all,

I have a more or less complex form with a few buttons and a few input
fields.
One of my my input field ( a TextBox) I have an event handler for the
TextChanged event.
What I want is that when I will hit enter in my input field, I expect to
form to be posted back to the server and the event handler for the
TextChanged event to be called.
If i tabulate from my text field, everythign is working fine. Nevertheless
when I hit the <enter> key instead of tabulating, then not only event
handler for that field is called but also the event handler of the first
button of my form. Why does this event fires? Is it because when I hit
<enter> the browser, translate it as if I clicked on that button? Or is it
due to some event mechanism in ASP.NET? Could anyone who understand what
really happen under the bush could explain it to me? And maybe give me a
hint on how to accomplish the desired behaviour.

Thanks in advance.

Here is some excerpts of my code:

ASPX page:
.....
<asp:textbox id="TextBoxInpu tAccountId" style="Z-INDEX: 150; LEFT: 312px;
POSITION: absolute; TOP: 8px" runat="server" Width="80px"
AutoPostBack="T rue">
.....

Code behind class:
In the InitializeCompo nent() called from the OnInit() method I have the
registration of my event handler for my event:
.....
this.TextBoxInp utAccountId.Tex tChanged += new
System.EventHan dler(this.LoadA ccountDetail);
.....
Generated HTML code for IE browser:

<script language="javas cript">
<!--
function __doPostBack(ev entTarget, eventArgument) {
var theform;
if (window.navigat or.appName.toLo werCase().index Of("netscape") > -1) {
theform = document.forms["FormMemberDeta ils"];
}
else {
theform = document.FormMe mberDetails;
}
theform.__EVENT TARGET.value = eventTarget.spl it("$").join(": ");
theform.__EVENT ARGUMENT.value = eventArgument;
theform.submit( );
}
// -->
</script>

.....
<input name="TextBoxIn putAccountId" type="text"
onchange="__doP ostBack('TextBo xInputAccountId ','')" language="javas cript"
id="TextBoxInpu tAccountId" />
.....
Nov 18 '05 #1
0 899

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

Similar topics

3
1267
by: Zachary | last post by:
Hello, I'm relatively new at Python, and am slightly confused about how the try...except mechanism is supposed to work. I am just not sure how it would be used, as it just seems that it is another sort of loop. Is their any sort of example I could look at, that has an example of how it is applied? I haven't really seen any such full example. Thanks, And Sorry for the newbie Question, Zack
10
3597
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
1
3430
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. I may have an output File.DLL, and ODBC.DLL, that instantiate an abstract parent to stream data i receive... an input .DLL allows data to be streamed
3
2079
by: Ashok Kumar K | last post by:
Hi all, Where can I get some insight on using the __hook, __unhook, event_source and event_receiver for specifically COM events. The documentation given in MSDN is very minimal. I have the following scenario Server (COM event source) is written in VC++ 6.0 using ATL (event interfaces can be either dispinterface / IDispatch based) Client (COM event receiver) is written in VC++ 2003 using attributed programming and unified event handling
0
1333
by: brunft | last post by:
I was testing this with .NET Framework 2.0. Exceptions in the Elapsed event handler of a System.Timers.Timer are ignored, they are not handled by the runtime and not reported (when running outside of VS.NET) either. Ther Timer continues as if nothing happened. Is this the desired behaviour, because this would have very negative impact on analysis of unexpected errors? Am i missing any design directives concerining the exception handling...
2
3722
by: tneilson | last post by:
I'm wondering if anyone has had this issue in a Windows 2000 Server enviroment. "The DB2 - DB2 service terminated unexpectedly. It has done this one time(s)." Indeed, going back through the logs which span back to the machine inception, there has never been an instance of this occuring. There are no other errors recorded with this. But a user was accessing Crystal Reports at the time.
8
36131
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query button on it. If the query returns multiple results, a new window is opened with a grid containing the results. When the user double clicks on the desired row in the grid, I want the first form to populate with the correct data. I don't know how...
22
1410
by: Oriane | last post by:
Hi there, I have to write an algorithm in .NET/C# which perform some task but has to be stopped after an intreval of dT seconds. Something like: dT = 30sec; for (;;) { t0 = GetCurrentTime (); for (i=0;...) { perform some operations;
2
21021
by: =?Utf-8?B?UmljaA==?= | last post by:
Is there a cancel argument for cancelling if you want to check or uncheck a checkbox? In the checkChanged event of a checkbox I ask the user if they are sure they want to check/uncheck something. If No, I want to cancel the check or uncheck and cancel the click event. Right now I have a form level boolean checkvar that I set based on the user's response. If No then when entering the click event I don't perform various actions. Is...
0
8713
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5961
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4730
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3160
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2528
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.