Sounds like your datagrid has ViewState disabled, or you are DataBinding on every 
postback in your Page_Load method.



Kirk

-----Original Message-----
From: Joćo Pedro Martins [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, 1 May 2002 7:13 a.m.
To: [EMAIL PROTECTED]
Subject: [DOTNET] Submit by pressing Return - event?


Hello,

question:

I have a normal runat=server form. In it I have
some input fields to specify search criteria,
a ImageButton that starts the search (with a server-side onclick event handler), and 
below it a data grid with the results. By default, this data grid is loaded with N of 
the most recent items of a sql table.

In the page there are also 2 datagrid paging buttons,
previous and next, each with a custom event handler.
These are regular LinkButtons.

My problem is simple, and is present as well in, for
example, the QuickStart Samples: *everything* works
fine if I mouse click the ImageButton or navigate with
the pager links: the data grid is updated, the input
fields keep their values, etc.

*IF*, however, I set the cursor focus on one of the
input fields, and just press Return on the keyboard,
the page reloads, the input fields lose their values,
and the datagrid is empty.

This happens because I am not "trapping" the "Submit"
event, if there is one, so I don't DataBind and the
data grid shows up empty. (I miss simple ASPs, sometimes)

Is there a way to prevent this?

I tried creating a server-side custom validator,
but no luck: it wasn't called.


I looked at some examples that work, but these use
Button's that are selected by default. Most don't work,
like I said, even in the QuickStart tutorials.


Any help would be appreciated,
j
--
Joćo Pedro Martins
[EMAIL PROTECTED]
|create|it|
http://www.create.pt
http://www.usabilidade.com

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe 
to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to