473,386 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Old Age Problem: Refresh Button Causes Postback

This is an old problem,, but I never had it so bad like this before,,
the events are refiring when clicking the Browser refresh button.
In the Submit button in my webform, I capture the server side click
event and I update session information to track the visibilty of some
panels in a wizard type navigation ("Next >>" and "<< Back" buttons)..
but the refresh button makes another event firing and takes the whole
thing to a Choes..

redirection to the same page/ saving state in a database is dumb and
should not be mentioned as an answer .. and Please, don't reply if you
are guessing.

thanks.
Nov 18 '05 #1
10 9209
This is more ranting and less of an explanation of what is happening and
what your problem really is....

When you hit refresh, you are not causing a postback. You are causing the
page class to be re-created and therefore, its New, Init, LoadViewState,
Page_Load , SaveViewState, control events and unload events are fired in
sequence. This is because of the stateless nature of the web, not ASP.NET.

PostBack occurs when form data is submitted. A refresh does not always
accomplish this.

What exactly is the problem you are experiencing. Pardon me if this sounds
sarcastic (it really isn't meant that way), but it's been my experience that
a better understanding of the Page class's lifecycle serves to eliminate
questions regarding postback.
"tasmisr" <ta*****@hotmail.com> wrote in message
news:ff**************************@posting.google.c om...
This is an old problem,, but I never had it so bad like this before,,
the events are refiring when clicking the Browser refresh button.
In the Submit button in my webform, I capture the server side click
event and I update session information to track the visibilty of some
panels in a wizard type navigation ("Next >>" and "<< Back" buttons)..
but the refresh button makes another event firing and takes the whole
thing to a Choes..

redirection to the same page/ saving state in a database is dumb and
should not be mentioned as an answer .. and Please, don't reply if you
are guessing.

thanks.

Nov 18 '05 #2
I know you are trying to help.
I fully understand the life cycle of the page object but I would
recommend that you step through the debugger and click the refresh
button and see what happens, the refresh button resubmits the data to
the server exactly the same as submitting the form for the first time.
Please I'm sick of submitting to these newsgroups and getting
nonhelpful answers, SO DON'T ANSWER IF YOU DON'T KNOW!
Nov 18 '05 #3
And here is the answer, to use a ViewState to retain the info instead
of the Session object.
Nov 18 '05 #4
Wow, you make me want to spend some time on your problem and help you out!

I stated in my last message: "PostBack occurs when form data is submitted.
A refresh does not always
accomplish this." This is true. If no data was submitted prior to the
refresh, then there is no data to repost. I said this in my first message
but you only tested it under one particular circumstance.

Are you sure you didn't write your "answer" backwards? Did you mean use
Session instead of ViewState? This would get around your re-posting problem
(since ViewState is on by default), but you now have to be very careful
since the session can be disabled by the client (session cookies) and the
server. Even if sessions are not disabled, they do take up overhead on the
server and if you are expecting any kind of significant volumne for the
page, they may not be the best solution.

Lastly, a word or 2 for you...I posted a reply to you and mentioned that
your post was not clear and that you needed to be more specific about what
problem you were having. You response was: "Please I'm sick of submitting
to these newsgroups and getting nonhelpful answers, SO DON'T ANSWER IF YOU
DON'T KNOW!"

So I guess I have this to say, "Please, I'm sick of reading posts that
aren't clear about what the problem is and are nothing more that venting
frustration at the rest of us, SO DON'T POST QUESTION IF YOU DON'T EXPLAIN
WHAT THE PROBLEM IS!"


"tasmisr" <ta*****@hotmail.com> wrote in message
news:ff**************************@posting.google.c om...
And here is the answer, to use a ViewState to retain the info instead
of the Session object.

Nov 18 '05 #5
ta*****@hotmail.com (tasmisr) wrote in message news:<ff*************************@posting.google.c om>...
Please I'm sick of submitting to these newsgroups and getting
nonhelpful answers, SO DON'T ANSWER IF YOU DON'T KNOW!


Hey, pal, chill out! Nobody OWES you anything here. People are posting
mostly out of the goodness of their hearts. If you are "sick" of it,
no one is forcing you to post! There are alternatives you know--here
are a few: post to a different group, don't post at all, call MS tech
support, buy a book on ASP.NET (and read it), read the MSDN help
files, hire someone else to do your job, don't do development in this
technology, get out of software development altogether... A quick
Google Groups search of the posts made from your email address shows
that people have been helpful to you more often than not.
Nov 18 '05 #6
>>People are posting mostly out of the goodness of their >>hearts.

I guess not, some people are not, they just don't understand the
technology and they are posting messages to build a community
existance.. I don't care about this but what I care about is when u look
at the threads summary (before u click on the thread)and u find at least
2 replies for a thread, u will think that someone already helped which
is not true.. This happens all the time on Google groups.. I originally
posted my question on google but this forum is linked somehow to it..

And Scott M: If you have enough expreince you would have understood my
question from the first post.

back to the topic: yes, I solved it by using ViewState to instead of the
Session object,I meant the ViewState collection of the page object like:
ViewState("key") = value
this way when you refresh, it will call the origianl value of the
ViewState("key") even it was modified after the first submission.

Tamer


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7

"tamer yousef" <ta*****@hotmail.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
People are posting mostly out of the goodness of their >>hearts.

I guess not, some people are not, they just don't understand the
technology and they are posting messages to build a community
existance.. I don't care about this but what I care about is when u look
at the threads summary (before u click on the thread)and u find at least
2 replies for a thread, u will think that someone already helped which
is not true.. This happens all the time on Google groups.. I originally
posted my question on google but this forum is linked somehow to it..

And Scott M: If you have enough expreince you would have understood my
question from the first post.

Don't blame me because you can not express yourself. I asked you in my
reply to be more clear about what problem you were having, your response was
that my answer was incorrect. I didn't give an answer, because you had not
supplied a question. I supplied general information about the page class
lifecycle in the hopes that this small amount of information could help you.
By the way, "you're welcome".

back to the topic: yes, I solved it by using ViewState to instead of the
Session object,I meant the ViewState collection of the page object like:
ViewState("key") = value
this way when you refresh, it will call the origianl value of the
ViewState("key") even it was modified after the first submission.


Why are you saying "instead of the Session object" when no one had suggested
the session object in the first place?

This is what I mean, you have been unclear about what you need, what you are
trying to do and what your attempts at a solution have been. This is one of
the basic tenants of how these NG's work. If it is frustrating to you that
the people who take their valuable time can't give you an answer based on
your vauge ranting, then you need to take the advice of "g pavlov"!

You've made a lot of friends here I can tell you!
Nov 18 '05 #8
>Don't blame me because you can not express yourself. I >asked you in my
reply to be more clear about what problem >you were having, your
response was
that my answer was incorrect.
U keep saying that my question was not clear, here is the original
question one more time:
In the Submit button in my webform, I capture the server >side click
event and I update session information to track the >visibilty of some
panels in a wizard type navigation ("Next >>" and "<< >Back" buttons)..
but the refresh button makes another event firing and >takes the whole
thing to a Choes..
The refresh Button has a known problem of re-submitting the data. AND AS
YOU CAN READ I CLREALY mention using the SESSION object to keep track of
a submission status, again if you have experienced this problem in a
real solution you would have know how to solve it without saying to me
in your second post:
This is more ranting and less of an explanation of what >is happening andwhat your problem really is....
and what make it worse, is that you started explaining the life cycle of
the page object and I clearly said in my first post:
In the Submit button in my webform, I capture the server side click

event

which means that I did submit data, but you replied by:
If no data was submitted prior to the
refresh, then there is no data to repost


So you are creating your own hypothetical problem and solving it.. this
doesn't really help!
I would say it if it was my bad but clearly not, it's your
replies(which I call answers) that are not related to the problem.
Go check online on this Refresh problem and you will see how clearly
everybody know about it and nobody have given a solution for it(other
than the 2 soultions I mentioned in my first post).

I want you next time when you have a critical problem in your program to
think back about this thread and get the feeling of being stuck and
wasting your time in a thread like.. and yah u'r right, I made 2 friends
here..
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #9
> U keep saying that my question was not clear, here is the original
question one more time:
In the Submit button in my webform, I capture the server >side click
event and I update session information to track the >visibilty of some
panels in a wizard type navigation ("Next >>" and "<< >Back" buttons)..
but the refresh button makes another event firing and >takes the whole
thing to a Choes..
There is nothing here that tells us what you are storing in session. Was is
data submitted from the form? Was it data that is related to the data
submitted from the form? UNCLEAR what you are doing with session. I'm
sorry if you feel that this is a complete explanation of what you are doing,
but the fact is, that it isn't even close!
The refresh Button has a known problem of re-submitting the data. AND AS
YOU CAN READ I CLREALY mention using the SESSION object to keep track of
a submission status, again if you have experienced this problem in a
real solution you would have know how to solve it without saying to me
in your second post:
Here is another example of your contempt. I usually don't insult the people
trying to help me. Now to business....There is (and never was) a known
"problem" with the refresh button. The way the refresh button works is a
matter of how HTML works and if you had any REAL experience with HTML, you
would know that. It's not a bug, it's by design.
This is more ranting and less of an explanation of what >is happening and
what your problem really is....


and what make it worse, is that you started explaining the life cycle of
the page object and I clearly said in my first post:
In the Submit button in my webform, I capture the server side click

event

which means that I did submit data, but you replied by:
If no data was submitted prior to the
refresh, then there is no data to repost


So you are creating your own hypothetical problem and solving it.. this
doesn't really help!


No, you are taking what I said out of context to server your own arrogance!
You said: "the refresh button resubmits the data to
the server exactly the same as submitting the form for the first time" and I
corrected you by saying that "PostBack occurs when form data is submitted.
A refresh does not always accomplish this." which is ABSOLUTELY TRUE, if you
had any REAL experience with ASP.NET, you'd know that.
I would say it if it was my bad but clearly not, it's your
replies(which I call answers) that are not related to the problem.
Go check online on this Refresh problem and you will see how clearly
everybody know about it and nobody have given a solution for it(other
than the 2 soultions I mentioned in my first post).
Again, this is not a problem, which is why no one is giving you a solution.
You've been very clear from the beginning what you DON'T want to hear. By
being ignorant like this ("redirection to the same page/ saving state in a
database is dumb and
should not be mentioned as an answer") tells us all that it is YOU who has
no real practical experience with ASP.NET / HTML.

I want you next time when you have a critical problem in your program to
think back about this thread and get the feeling of being stuck and
wasting your time in a thread like.. and yah u'r right, I made 2 friends
here..


And I wish that the next time you extend your hand to help someone, that
they bite it right off!!
Nov 18 '05 #10
Real funny, I have enough understanding and practical experince with
HTML and .Net.
If you don't understand the question don't create your own assumptions
and answers for these assumptions.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Johnson Jr. | last post by:
The problem is the following pseudo code causes you need to click buttons twice to get event. This is notable via debugging and single stepping. I can't seem to quite figure out how to do...
3
by: Rich | last post by:
Hi everyone, I have run into a quandry here. Here is a simplified scenario that mirrors my real problem. I have a page that has 2 buttons: On page load, the page runs some complex...
6
by: bhavik | last post by:
hi i have one aspx page on which i have one button in code behind i wrote a code for inserting a record. if i clicik on button it inserts a record ok ite fine but the problem is that if i...
4
by: sandhya.net | last post by:
Hi, I have a dropdown which displays the Products and Add button on my Asp.net web page. When the user selects a product from the dropdown and Clicks the add button it adds the selected product...
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
3
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes...
4
by: William Sullivan | last post by:
I have an extremely weird problem that I have no idea how to approach. I have a simple page with a search textbox and a search button. The button causes a postback, where I perform the search and...
0
by: anandv81 | last post by:
Hi, I encountered a strange problem while working on an application, the problem goes like this. I am generating a few textboxes at runtime at the server side and added to a placeholder, a...
4
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. If an ASP.NET page postsback, for example, after a button is clicked, and then I refresh the page (ie, by pressing F5 key), why does the same event occur when I press F5 as it did when I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.