473,573 Members | 4,174 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9232
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*****@hotmai l.com> wrote in message
news:ff******** *************** ***@posting.goo gle.com...
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*****@hotmai l.com> wrote in message
news:ff******** *************** ***@posting.goo gle.com...
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.goo gle.com>...
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*****@hotmai l.com> wrote in message
news:uN******** ******@TK2MSFTN GP09.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....The re 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 ("redirectio n 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

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

Similar topics

3
1530
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 events in ASP where they need to rerender the page. I been banging my head on this for 4 days now.
3
1652
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 initialization routines. Clicking button 1 causes a postback in which I WANT the initialization routines to run before the event handler. The net of this is...
6
1281
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 refresh the page it will go again into button_click event and add the same record again why so. ?
4
1455
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 to the datagrid. The problem is when the user adds the product and clicks the refresh button on the browser,the same item is added to the...
9
7727
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 remember that I clicked a button before the refresh. Here is what is going on: 1) Page Loads 2) User enters some values, clicks the "Save" button 3)...
3
2570
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 a postback to occur which in turn triggers a sub in a user control... Error: Argument not specified for parameter e of Public Sub...
4
1422
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 display the results in a DIV that has a tree. I've tested all the code up until I add in the code for adjusting the tree in the DIV and it all...
0
1583
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 value is set for each of the textboxes. There is a button that causes the page to be posted back and the texboxes are re-rendered. When the textboxes...
4
6718
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 clicked the button? For example - On an ASP.NET webform I click a button which produces a postback and a Button.Click event. After the postback, I...
0
7788
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8037
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7799
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8080
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6430
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5604
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3737
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1320
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.