473,320 Members | 1,949 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,320 software developers and data experts.

AutoPostBack question.

Hi,

I'm having a straight HTML <input type="text"
onkeypress="CheckKey();"> within a <form runat="server">.
When I press ENTER when in the textbox, the client-side
CheckKey() function is executed but still the form or page
seems to do an AutoPostBack to the server.

Any ideas on how to avoid this postback?
Thanx a lot in advance,

Domien
Nov 17 '05 #1
2 1981
Hi Domien

Just use return; statement in your javascript function.

HTH
Ravikanth

-----Original Message-----
Hi,

I'm having a straight HTML <input type="text"
onkeypress="CheckKey();"> within a <form runat="server">.When I press ENTER when in the textbox, the client-side
CheckKey() function is executed but still the form or pageseems to do an AutoPostBack to the server.

Any ideas on how to avoid this postback?
Thanx a lot in advance,

Domien
.

Nov 17 '05 #2
The statement has to say "return false", and your onclick event has to say
"return CheckKey();".
Also, this is just a plain submit to the server, this is not related to the
autopostback that can happen with a dropdown.

"Domien Holthof" <do************@alcopa2wheels.com> wrote in message
news:09****************************@phx.gbl...
Hi Ravikanth,

I didn't realy understood what you meant, so I tried to
make the function look like this:

function CheckKey()
{
... // My code to check the key and do stuff...
return;
}

That didn't solve it. Next I tried this :
function CheckKey()
{
... // My code to check the key and do stuff...
return false;
}

That didn't do the trick either. But could anyone tell
WHAT is causing the postback and how to prevent it?

Thanx,
Domien
-----Original Message-----
Hi Domien

Just use return; statement in your javascript function.

HTH
Ravikanth

-----Original Message-----
Hi,

I'm having a straight HTML <input type="text"
onkeypress="CheckKey();"> within a <form

runat="server">.
When I press ENTER when in the textbox, the client-side
CheckKey() function is executed but still the form or

page
seems to do an AutoPostBack to the server.

Any ideas on how to avoid this postback?
Thanx a lot in advance,

Domien
.

.

Nov 17 '05 #3

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

Similar topics

4
by: Jesse | last post by:
I have a relatively long page with a number of webcontrols with "autopostback" set to true. The contents/items/datasources of the subsequent webcontrols are dynamically populated depending on the...
8
by: Matthew Louden | last post by:
why need to set autopostback property to be true?? I know autopostback event means to send the form to the server automatically. I tried checkbox, checkbox list, radio button, and radio button...
2
by: SLE | last post by:
A web user control exposes a RadioButtonList (with AutoPostBack = true) called "Question". This control also has an embedded RequiredFieldValidator control. 1. Main ASPX page is populated with...
1
by: Pete Davis | last post by:
First of all, I'm more or less a novice at web stuff, not just ASP.NET but JavaScript and VBScript as well. I've got a page for doing reservations for a hotel. They want to do two things that...
4
by: JJ | last post by:
Hi, I need to have a button cause an autopostback. How can I do this? I have textboxs on webform that supply values for a calc but not all will get filled at any particular time. So I need a...
2
by: Tom Edelbrok | last post by:
Question: Why does a button event (ie: Button1_Click) get executed on the first click for a textbox control which has 'autopostback=false', but doesn't get executed until a second click when...
2
by: rn5a | last post by:
Assume that a user control has a TextBox (Page1.ascx) <asp:TextBox ID="txtName" runat="server"/> I am encapsulating the above user control in a ASPX page named Page1.aspx i.e. the ASPX page...
4
by: =?Utf-8?B?UmVuYXVkIExhbmdpcw==?= | last post by:
Hello, I have a strange yet very simple problem with the asp.net Textbox web control. On an empty asp.net page, add a single asp:TextBox control with Autopostback=false with nothing else on...
6
by: Peter | last post by:
ASP.NET 2.0 Visual Studio 2008 I have the following code and when the textbox displays and I press Enter while in the text box I get AutoPostBack, how do I stop AutoPostBack? TextBox txt =...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.