Very, very, easy question


John Hoge

I need to do something on a page with a datagrid in the case where the
page is loaded but the Update button is *not* clicked.

Specifically, I am adding a blank row to the dataset with an external
Add button. The dataset is strongly typed, so I can't add a blank
value to the primary key. I put a "Temp" string in this field so the
user can add a new value when the page is loaded with that row set as
editable. If the user doesn'
t click update, I want to reload the dataset from the dataadapter and
bind to the datagrid, thus removing the temporary row that has not
been filled out.

Is there a way, short of a kludge like using session variables in
every other event, that I can test for this using the EventArgs object
passed to Page_Load?




John Hoge

Curt_C said:
no click here
somethign posted back

It's not quite *that* easy! I want to refresh the dataset if the even
triggering the page load is anything but an update. It could be a
postback for some other reason.

Is there a way to see, in the Page_Load method, the specific control
that triggered the postback. In other words,

private void Page_Load(object o, EventArgs e){
if (**Event calling this page is not the update button from

I have several controls on this page, and I want to make sure that the
dataset is refreshed in all circumstances, except when the user has
just clicked update.





You can add a little javascript on the onclick handler of the update
button to change the value of a hidden field on the page and you can
check *that* in page load.

I just did a whole navigation system that relies on this method.

Many of us wish we could get the postback args in page load.
Sometimes I think that if a couple of us got in a room together for
three hours we could design something better than Microsoft.


PS Could you check the __EVENT_TARGET in the forms collection to see
if it looked like your update buttons? Just a thought.