By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,885 Members | 1,499 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,885 IT Pros & Developers. It's quick & easy.

Detection of data changes in a page

P: n/a
Hallo,

I've got a project with about 10 pages. On each of them the user can do data
changes (mostly datagrid interactions; the datagrids are bound to datasets).

The user is able to jump to each page of my project without clicking on the
"save" button and he can also close the browser without saving.

My customer wants the user to be informed about loss of data. If any page is
left without saving data changes then on the same page a message should be
shown "Do you want to save data before leaving this page?" and there should
be two buttons "Yes"/"No" in a certain design (no javascript message box!).

So I have got big trouble with this problem.

First I implemented a javascript function that is called on each
"OnBeforeUnload" event of the HTML body. This function just checks for data
changes and if so then re-calls the same page again. So on server side I was
able to detect changes and put the request for saving to the page content.
But the "OnBeforeUnload" event is also fired on each server-roundtrip when
doing any datagrid operation such as selecting an item.

With the "OnBeforeUnload" event it is not possible to call a server function
directly, only client-side javascript is possible.

I am running out of ideas. Has anyone a tip for me to solve this general
problem?

Thanks a lot !!!
Nov 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Do you have links between the pages? If so put the check there, before the
page redirects you can put in your mesage etc.

As for the User shutting the browser. I can see why they might want that
prompt, but it would not be standard "Web" behaviour. I would suggest you
just have an onscreen graphic that indicates the data is unsaved, which
changes when they save.
Nov 19 '05 #2

P: n/a
Thank you, Josh.

There are links between my pages but for some reasons I can not use them for
a data change check.
The user can also navigate through my project by other technics and so that
does not work.

I thought there might be any workaround or general solution even if it is
not a common web behaviour to do anything on page unload.
I thought ASP.NET is a real alternative to windows forms applications...
Perhaps in one of the future versions there is a build-in solution for my
problem - I trust in Microsoft ;-)

I anyone else has any idea I would be a very lucky programmer....

"Josh" <s@a.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP12.phx.gbl...
Do you have links between the pages? If so put the check there, before
the page redirects you can put in your mesage etc.

As for the User shutting the browser. I can see why they might want that
prompt, but it would not be standard "Web" behaviour. I would suggest you
just have an onscreen graphic that indicates the data is unsaved, which
changes when they save.

Nov 19 '05 #3

P: n/a
You can make use of session variables here, keep an array in the session
having two coloumns one for the page name and other for the Save status, keep
updating this array whenever user clicks the save button, defaults the Save
status to No.

Now i whenever user jumps from one page to another just run a loop to check
for the save status in the session variable for the current page and then you
can take the appropriate action you can popup a winow where in you can ask
user about the confirmation and take the appropriate action.

Hope this Helps.

"Frank Esser" wrote:
Thank you, Josh.

There are links between my pages but for some reasons I can not use them for
a data change check.
The user can also navigate through my project by other technics and so that
does not work.

I thought there might be any workaround or general solution even if it is
not a common web behaviour to do anything on page unload.
I thought ASP.NET is a real alternative to windows forms applications...
Perhaps in one of the future versions there is a build-in solution for my
problem - I trust in Microsoft ;-)

I anyone else has any idea I would be a very lucky programmer....

"Josh" <s@a.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP12.phx.gbl...
Do you have links between the pages? If so put the check there, before
the page redirects you can put in your mesage etc.

As for the User shutting the browser. I can see why they might want that
prompt, but it would not be standard "Web" behaviour. I would suggest you
just have an onscreen graphic that indicates the data is unsaved, which
changes when they save.


Nov 19 '05 #4

P: n/a
Thanks a lot for your answer.

Yes, indeed, this would help me and I already thought about such a solution.
There are some disadvantages, but I think I will do it this way.

Disadvantages of this solution:
- Closing the browser will not check for data changes
- Jumping to another page will cause a redirect to the former page with
request for saving and then? I have to jump back to the intended page
afterwards. If there is another page between to display the save result it
would be difficult for me to handle the whole workflow with different states
and flags ("state machine"). It would be much more compfortable not to leave
the page where data changes occured.

Regards
Frank

"Hitesh" <Hi****@discussions.microsoft.com> schrieb im Newsbeitrag
news:F1**********************************@microsof t.com...
You can make use of session variables here, keep an array in the session
having two coloumns one for the page name and other for the Save status,
keep
updating this array whenever user clicks the save button, defaults the
Save
status to No.

Now i whenever user jumps from one page to another just run a loop to
check
for the save status in the session variable for the current page and then
you
can take the appropriate action you can popup a winow where in you can ask
user about the confirmation and take the appropriate action.

Hope this Helps.

"Frank Esser" wrote:
Thank you, Josh.

There are links between my pages but for some reasons I can not use them
for
a data change check.
The user can also navigate through my project by other technics and so
that
does not work.

I thought there might be any workaround or general solution even if it is
not a common web behaviour to do anything on page unload.
I thought ASP.NET is a real alternative to windows forms applications...
Perhaps in one of the future versions there is a build-in solution for my
problem - I trust in Microsoft ;-)

I anyone else has any idea I would be a very lucky programmer....

"Josh" <s@a.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Do you have links between the pages? If so put the check there, before
> the page redirects you can put in your mesage etc.
>
> As for the User shutting the browser. I can see why they might want
> that
> prompt, but it would not be standard "Web" behaviour. I would suggest
> you
> just have an onscreen graphic that indicates the data is unsaved, which
> changes when they save.
>


Nov 19 '05 #5

P: n/a
I really dont know how you have implemented the Jumping between pages is it a
linear (clicking on Next) or its a non-linear like user can jump to any page
they want.
If you can give me some details about this then i can think on top of that
so that we can minimize the disadvantages.
"Frank Esser" wrote:
Thanks a lot for your answer.

Yes, indeed, this would help me and I already thought about such a solution.
There are some disadvantages, but I think I will do it this way.

Disadvantages of this solution:
- Closing the browser will not check for data changes
- Jumping to another page will cause a redirect to the former page with
request for saving and then? I have to jump back to the intended page
afterwards. If there is another page between to display the save result it
would be difficult for me to handle the whole workflow with different states
and flags ("state machine"). It would be much more compfortable not to leave
the page where data changes occured.

Regards
Frank

"Hitesh" <Hi****@discussions.microsoft.com> schrieb im Newsbeitrag
news:F1**********************************@microsof t.com...
You can make use of session variables here, keep an array in the session
having two coloumns one for the page name and other for the Save status,
keep
updating this array whenever user clicks the save button, defaults the
Save
status to No.

Now i whenever user jumps from one page to another just run a loop to
check
for the save status in the session variable for the current page and then
you
can take the appropriate action you can popup a winow where in you can ask
user about the confirmation and take the appropriate action.

Hope this Helps.

"Frank Esser" wrote:
Thank you, Josh.

There are links between my pages but for some reasons I can not use them
for
a data change check.
The user can also navigate through my project by other technics and so
that
does not work.

I thought there might be any workaround or general solution even if it is
not a common web behaviour to do anything on page unload.
I thought ASP.NET is a real alternative to windows forms applications...
Perhaps in one of the future versions there is a build-in solution for my
problem - I trust in Microsoft ;-)

I anyone else has any idea I would be a very lucky programmer....

"Josh" <s@a.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP12.phx.gbl...
> Do you have links between the pages? If so put the check there, before
> the page redirects you can put in your mesage etc.
>
> As for the User shutting the browser. I can see why they might want
> that
> prompt, but it would not be standard "Web" behaviour. I would suggest
> you
> just have an onscreen graphic that indicates the data is unsaved, which
> changes when they save.
>


Nov 19 '05 #6

P: n/a
Hello,

to be honest: I did not tell you the whole story.
My ten pages are not called by a standard web browser but by a industrial
machine with an embedded terminal. This machine has a kind of primitive
self-written browser.
The page names are implemented in this browser and so the user can jump to
each page by a navigation panel that I can not influence.
So on server-side I have my session object and my page-load event to do
anything but I can not recognize the click on the navigation panel itself.
So I can not put a "was-it-saved-check" in a "on-navigation-click-event".

So you perhaps (and hopefully) understand why it is difficult for me to
implement a "data-changed-detection"...

The most difficult requirement spec in this project is that not only the
customers industrial machine as a terminal browser has to be served but as
well a standard browser in case of using e.g. a tablet PC. That means my
server architecture has to cover both client types.

I think it would go to much to detail to explain everything of this project
but I think it is a little bit more clear now what my problem is, isn't it
???
"Hitesh" <Hi****@discussions.microsoft.com> schrieb im Newsbeitrag
news:4B**********************************@microsof t.com...
I really dont know how you have implemented the Jumping between pages is it
a
linear (clicking on Next) or its a non-linear like user can jump to any
page
they want.
If you can give me some details about this then i can think on top of that
so that we can minimize the disadvantages.
"Frank Esser" wrote:
Thanks a lot for your answer.

Yes, indeed, this would help me and I already thought about such a
solution.
There are some disadvantages, but I think I will do it this way.

Disadvantages of this solution:
- Closing the browser will not check for data changes
- Jumping to another page will cause a redirect to the former page with
request for saving and then? I have to jump back to the intended page
afterwards. If there is another page between to display the save result
it
would be difficult for me to handle the whole workflow with different
states
and flags ("state machine"). It would be much more compfortable not to
leave
the page where data changes occured.

Regards
Frank

"Hitesh" <Hi****@discussions.microsoft.com> schrieb im Newsbeitrag
news:F1**********************************@microsof t.com...
> You can make use of session variables here, keep an array in the
> session
> having two coloumns one for the page name and other for the Save
> status,
> keep
> updating this array whenever user clicks the save button, defaults the
> Save
> status to No.
>
> Now i whenever user jumps from one page to another just run a loop to
> check
> for the save status in the session variable for the current page and
> then
> you
> can take the appropriate action you can popup a winow where in you can
> ask
> user about the confirmation and take the appropriate action.
>
> Hope this Helps.
>
> "Frank Esser" wrote:
>
>> Thank you, Josh.
>>
>> There are links between my pages but for some reasons I can not use
>> them
>> for
>> a data change check.
>> The user can also navigate through my project by other technics and so
>> that
>> does not work.
>>
>> I thought there might be any workaround or general solution even if it
>> is
>> not a common web behaviour to do anything on page unload.
>> I thought ASP.NET is a real alternative to windows forms
>> applications...
>> Perhaps in one of the future versions there is a build-in solution for
>> my
>> problem - I trust in Microsoft ;-)
>>
>> I anyone else has any idea I would be a very lucky programmer....
>>
>> "Josh" <s@a.com> schrieb im Newsbeitrag
>> news:%2****************@TK2MSFTNGP12.phx.gbl...
>> > Do you have links between the pages? If so put the check there,
>> > before
>> > the page redirects you can put in your mesage etc.
>> >
>> > As for the User shutting the browser. I can see why they might want
>> > that
>> > prompt, but it would not be standard "Web" behaviour. I would
>> > suggest
>> > you
>> > just have an onscreen graphic that indicates the data is unsaved,
>> > which
>> > changes when they save.
>> >
>>
>>
>>


Nov 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.