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

OnKeyPress = "reload page"

Hi

I've got the following in my aspx

<asp:textbox id="findwhat" OnKeyPress="javascript: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 2152
Dan,

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

Eliyahu

"dhnriverside" <da*@musoswire.com> wrote in message
news:49**********************************@microsof t.com...
Hi

I've got the following in my aspx

<asp:textbox id="findwhat" OnKeyPress="javascript: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

"dhnriverside" <da*@musoswire.com> wrote in message
news:49**********************************@microsof t.com...
Hi

I've got the following in my aspx

<asp:textbox id="findwhat"

OnKeyPress="javascript: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='findwhat.focus()'>

Eliyahu

"dhnriverside" <da*@musoswire.com> wrote in message
news:34**********************************@microsof t.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

"dhnriverside" <da*@musoswire.com> wrote in message
news:49**********************************@microsof t.com...
Hi

I've got the following in my aspx

<asp:textbox id="findwhat"

OnKeyPress="javascript: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
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...
3
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...
3
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. ...
1
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...
7
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....
3
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...
6
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...
6
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.