473,287 Members | 1,827 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,287 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 9206
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.