473,804 Members | 2,999 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnKeyPress = "reload page"

Hi

I've got the following in my aspx

<asp:textbox id="findwhat" OnKeyPress="jav ascript:suggest ()"></asp:textbox>

and the suggest function

function suggest()
{
getElementById[btnfind'].click();
}

btnfind is an asp:imagebutton control, with a handler in the codebehind. So
in theory, typing in the box performs whatever action pressing that button
does. Except it doesnt. It reloads the page, completely.

Any idea whats going on!?

Cheers
Dan
Nov 19 '05 #1
3 2171
Dan,

btnfind is a server button and as such it causes a postback. Consider using
Ajax.

Eliyahu

"dhnriversi de" <da*@musoswire. com> wrote in message
news:49******** *************** ***********@mic rosoft.com...
Hi

I've got the following in my aspx

<asp:textbox id="findwhat" OnKeyPress="jav ascript:suggest ()"></asp:textbox>
and the suggest function

function suggest()
{
getElementById[btnfind'].click();
}

btnfind is an asp:imagebutton control, with a handler in the codebehind. So in theory, typing in the box performs whatever action pressing that button
does. Except it doesnt. It reloads the page, completely.

Any idea whats going on!?

Cheers
Dan

Nov 19 '05 #2
Tried 3 different implementations of AJAX and none of them work for me!
Anyway, fixed it now cheers.

Problem now is how to put the cursor back into the textbox after refresh -
without selecting the text. Any thoughts?

"Eliyahu Goldin" wrote:
Dan,

btnfind is a server button and as such it causes a postback. Consider using
Ajax.

Eliyahu

"dhnriversi de" <da*@musoswire. com> wrote in message
news:49******** *************** ***********@mic rosoft.com...
Hi

I've got the following in my aspx

<asp:textbox id="findwhat"

OnKeyPress="jav ascript:suggest ()"></asp:textbox>

and the suggest function

function suggest()
{
getElementById[btnfind'].click();
}

btnfind is an asp:imagebutton control, with a handler in the codebehind.

So
in theory, typing in the box performs whatever action pressing that button
does. Except it doesnt. It reloads the page, completely.

Any idea whats going on!?

Cheers
Dan


Nov 19 '05 #3
<body onload='findwha t.focus()'>

Eliyahu

"dhnriversi de" <da*@musoswire. com> wrote in message
news:34******** *************** ***********@mic rosoft.com...
Tried 3 different implementations of AJAX and none of them work for me!
Anyway, fixed it now cheers.

Problem now is how to put the cursor back into the textbox after refresh -
without selecting the text. Any thoughts?

"Eliyahu Goldin" wrote:
Dan,

btnfind is a server button and as such it causes a postback. Consider using Ajax.

Eliyahu

"dhnriversi de" <da*@musoswire. com> wrote in message
news:49******** *************** ***********@mic rosoft.com...
Hi

I've got the following in my aspx

<asp:textbox id="findwhat"

OnKeyPress="jav ascript:suggest ()"></asp:textbox>

and the suggest function

function suggest()
{
getElementById[btnfind'].click();
}

btnfind is an asp:imagebutton control, with a handler in the codebehind.
So
in theory, typing in the box performs whatever action pressing that

button does. Except it doesnt. It reloads the page, completely.

Any idea whats going on!?

Cheers
Dan


Nov 19 '05 #4

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

Similar topics

2
1953
by: TR | last post by:
In an "Abandon Changes" button on my UserPreferences.aspx form, I'd like to redirect back to the page the user was on before coming to the UserPreferences form. It could be any one of my web app's pages with a link to the UserPreferences page in its topmenu. (I'm testing for stale session tokens and can prevent users from bookmarking the page.) However, in codebehind for the AbandonChanges click event, the REFERRER is the UserPreferences...
3
2103
by: NuB | last post by:
I have a C# web form that allows the user to perform a search if all the required fields are filled in, which works fine, my issue is if a user does a sucessfull search then enters in data and misses a field they get a message "field Name is missing" the result grid remains, how can I have the grid not shown from the prior successful search if the users gets a validation error for missing a required field or of no records are found?
3
11205
by: Unnikrishnan | last post by:
Hi Pals, I want to know about that how IIS Server comes to know about the starting page of any application built in C# or Vb.NET. Though in IDE, we are doing this by right clicking the selected web page from application & choosing the "Set As Start Page". But how IIS Server comes to know about it? I will appreciate if any one...
1
1827
by: Jeff | last post by:
I need to place a "Previous Page" link on every page within my site and a simple javascript:history.back() will not work because I need it to capture the state of the page when I left it. For example, if I have a page with some date controls so I can choose a date range and postback the page. It then displays results based on that date range. When I leave the page for another page, I would like to have the Previous Page link take them...
7
14709
by: Anette | last post by:
Hi, I'm very new at PHP. I've tried for a long time now to get a page that has a form in a certain way: 1. When form is submitted the data in a table should be writted on the same page. 2. When I load and reload the page I want it to be lika a new session (only show the form not the data). As it is now isset($_POST and isset($_POST is always set and the data is always shown. Except when a click the link "Please try again" (hich is a...
3
2323
by: Willy | last post by:
I have a website that uses querystrings on a certain page to show multiple contents. I have created mapped pages to hide the gory details of these querystrings. So instead of details.aspx?ID=kldjlkdjldsjlkds&cat=jjfjfj the client sees products.aspx I also use these "mapped" pages in my sitemap file. This site is multilingual so I have buttons on the page to switch languages.
6
8028
by: James Yang | last post by:
"bad page", especially in table, is a risk for database maintenance. The particular access attempt for corrupt blocks may not occur often, and corrupt DB2 blocks are not recognized during a database backup, corrupt blocks can remain undetected in an UDB system for a long time. The potential solution is: 1) Restore from a GOOD backup and rollforward (Recommended). The problem is backup normally is kept for 30 days so we must find the...
6
5239
sueb
by: sueb | last post by:
I'm implementing a report that has an entirely different first page than the rest of the pages (the first page gets printed on an original form, but the following pages have their much-more-simple form embedded in the Access report). Currently, I have two separate reports, invoked sequentially by a single button on the menu. Clicking that button requres the user to enter the Account number twice, once for each report: Private Sub...
0
9572
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
10562
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
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
9132
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
7608
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
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.