When ViewState is disabled on the grid, the values in it aren't remembered on 
post-backs.

If you want the grid to be rebound on _every_ postback, even if there is no button 
clicked, then you'll have to do it in the page code (like Page_Load).

The problem with Link Buttons, and any other buttons that don't render as <input> 
tags, is that the event is run only when someone clicks on them (and fires the 
javascript)... If the form is submitted by someone pressing Enter in a field, then the 
event won't fire.

Not sure how to fix that!

Kirk

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


At 12:46 01-05-2002 +1200, you wrote:
>Sounds like your datagrid has ViewState disabled, or you are 
>DataBinding
>on every postback in your Page_Load method.

True, False.

Is there any server-side event I can catch when the user
simply submits the form in a situation like the one I described? (basically, imagine 
an input field with a submit button that is an image and NOT a "regular" Button). The 
onclick@server is not ran.

The Grid is being binded to a SqlDataReader, not a DataSet,
so I have to rebind when the user navigates in the pages.

j



>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.

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