JS OnKeyPress causes button click

G

Guest

Hi

I've got a form with a TextBox and an invisible button, and I've got it set
so that pressing enter causes the button to click. WOrks fine, the forms
submits on enter and my datalist refreshes (tis a search textbox/list).

I'm trying to implement AJAX style behaviour (its an intranet) - so as you
type in the box, it refreshes the results list.

So far I've tried OnKeyPress="TextChange" - where TextChange is a public C#
method in Codebehind, I've tried
OnKeyPress="javascript:document.form1.submit()" and ive just tried
OnKeyPress="__doPostBack(blah...)" - all with the same effect.

The form submits itself, as you;d expect, but then when it returns,
everything is reset to when the page was first loaded (eg. txtbox is set to
"Type here" etc). It's like it's reloading the page from scratch, and
ignoring ViewState. ViewState is switched on thouh.

I don't know whats wrong - any suggestions on how to do this!?

I should point out that the textbox and hidden imagebutton are in a user
control - dunno if that makes any diff?

Cheers



Dan
 
F

Ferret Face

You might have to start messing with the PostBack method(s).

What to the group gurus think?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top