Author |
Topic |
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-03 : 05:38:50
|
Hello All,is there a simple way of preventing page refresh in .netI had to write some code to assign a session variable to prevent refereshing the page.Any simpler methods ?thanksEhi |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-03 : 05:46:35
|
How do you stop keybord shortcut Ctrl-F5? E 12°55'05.63"N 56°04'39.26" |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-03 : 05:50:03
|
??? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-03 : 05:54:44
|
What I meant, is that you cannot stop the refresh of a page.An user can press F5 or Ctrl-F5 to refresg the page anyway.Or click the Refresh button.Or maybe you are referring to another underlying problem and think refresh of page is the problem? E 12°55'05.63"N 56°04'39.26" |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-03 : 06:23:20
|
no no noWell with webforms, when u have a page that might take a while to process. You dont want users refreshing the page in an auto postback. I wrote a script to stop it. But having loads of ajax controls, which also make postbacks to the page when called. It conflicts with the script and loops endlessly. So its flawed. so am looking for a simpler way around it. |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-03 : 09:26:54
|
ok |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-09-03 : 10:29:19
|
I found a very simple way. Set a hidden value in the form, and increment it on the button1 click event. So if it is a postback the value is 1 and if its onpage load the value is 0And for the button load event, it will redirect it to a fresh page if its a referesh.Quite simple :) string SendOnce = count.Value.ToString(); if (SendOnce == "1") { goto endexecution; } if (SendOnce == "0") { count.Value = "1"; } |
|
|
|