Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > postback problem

Reply
Thread Tools

postback problem

 
 
Alessandro
Guest
Posts: n/a
 
      10-11-2004
Hi !

I have a aspx page with these controls:

1) a texbox to find person with a specific name....
2) a button nto perform the search
3) a datagrid tho show all user

If i have the focus on the texbox and i click enter i have a
postback.............. but i dont' want it, because the datagrid doesn't
bind correctly... i must click on the button to do the postback......

Any idea ?


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBNVlA=?=
Guest
Posts: n/a
 
      10-11-2004
The general cause here is the "default" button is fired, instead of the
button you desire to be hit. For a simple form, try:

Page.RegisterHiddenField( "__EVENTTARGET", "btnSearch" );

Change btnSearch to your button name. That will fire the correct button for
the form.

If you need a particular button for different textboxes, you will have to
move to JavaScript. Try this link for a C# method that writes out the
JavaScript:

http://dotnetjunkies.com/WebLog/darr...3/03/8374.aspx

It is further culled here:

http://www.experts-exchange.com/Prog..._20944907.html

To disable the enter key, you have to trap that event in JavaScript. I would
not head this direction unless absolutely necessary.


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


"Alessandro" wrote:

> Hi !
>
> I have a aspx page with these controls:
>
> 1) a texbox to find person with a specific name....
> 2) a button nto perform the search
> 3) a datagrid tho show all user
>
> If i have the focus on the texbox and i click enter i have a
> postback.............. but i dont' want it, because the datagrid doesn't
> bind correctly... i must click on the button to do the postback......
>
> Any idea ?
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using callback, I fill dorpdownlist without postback but it gets empty when a postback is executed Fabio Mastria ASP .Net 5 01-30-2008 09:07 PM
ShowDialogModal postback on close (this is not related to multiple dialogs opening upon postback) Jacky Chau ASP .Net 2 06-08-2005 05:49 PM
Can I raise a postback ? Session variable only visible after postback. Please help gce ASP .Net 2 05-08-2005 05:55 AM
Postback not being set to True on first postback =?Utf-8?B?Q2hhZA==?= ASP .Net 2 04-04-2005 06:17 PM
effecting postback without auto postback controls Psych971 ASP .Net 5 12-17-2004 08:53 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57