472,373 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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="TextBoxInputAccountId" style="Z-INDEX: 150; LEFT: 312px;
POSITION: absolute; TOP: 8px" runat="server" Width="80px"
AutoPostBack="True">
.....

Code behind class:
In the InitializeComponent() called from the OnInit() method I have the
registration of my event handler for my event:
.....
this.TextBoxInputAccountId.TextChanged += new
System.EventHandler(this.LoadAccountDetail);
.....
Generated HTML code for IE browser:

<script language="javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("n etscape") > -1) {
theform = document.forms["FormMemberDetails"];
}
else {
theform = document.FormMemberDetails;
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>

.....
<input name="TextBoxInputAccountId" type="text"
onchange="__doPostBack('TextBoxInputAccountId','') " language="javascript"
id="TextBoxInputAccountId" />
.....
Nov 18 '05 #1
0 859

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

Similar topics

3
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...
10
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...
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....
3
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...
0
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...
2
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...
8
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...
22
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...
2
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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.

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.