Prevent browser refreshes from posting back an already-posted-back form?

Hi

I have a formview in insert mode for inserting items into a gridview.  Each item is some description text, a price, and a quantity.  I'm using SqlDataSource controls while I learn about the New Way of Doing Things.

If I insert an item, and then refresh the now-posted-back page in my browser, the same item gets inserted again.  I would like to prevent this, ideally without response.redirecting on FormView.ItemInserted every time a new item is inserted.  I don't think it'd be a question of clearing the inputs and validating for data, would it?  I mean, an F5 will repost the form, and validation fires on button clicks (etc), not refreshes.

Is there the facility to do this within the .NET 2 framework?
0
pfm102
5/12/2006 9:40:16 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
1111 Views

Similar Articles

[PageSpeed] 50

See the "Trap the Browser Refresh" section of this article:

http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnvs05/html/BedrockAspNet.asp

Darrell Norton, MVP
Darrell Norton's Blog


Please mark this post as answered if it helped you!
0
DarrellNorton
5/12/2006 6:39:51 PM
Reply:

Similar Artilces:

Question on Post back. Post back to WHAT???
   Hello I am learning about asp.net. I know that Postback refers to a page being submitted to the web server. But, what is meant when a pages "Posts back to itself" ??? Is this the same thing as the single word Post Back. I ask this, because from what I have read, View State works only if a page "Posts back to itself". Does this terminology refering to a single post back to the server, or a round trip. Please help.     When a page does a PostBack, it basically does a form submit back to itself. All controls/variables are re-instantiated, and then re-populated from...

How to prevent my formview from posting back on browser refresh ?
 I have a Formview control to upload pdf files. But sometimes after i had uploaded my files if i refresh my page it submits the same file again. I did some research and i found that i need to use something like If Not Page.IsPostback = False  clause at the beginning of my code but i dont know how to properly use this. Can anybody please educate me about this problem.my code is1 Protected Sub FormView1_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewInsertEventArgs) Handles FormView1.ItemInserting 2 3 ' Reference the FileUpl...

How to post back without really posting back?
I call a web service to get a value to update a textbox in response to a client side (javascript) event. Once I have that value I also need to update a RangeValidator's MaximumValue property. There doesn't seem to be a way to do this from the client side and I really don't want to do a full postback just to update this property. Can someone suggest an alternative? Thanks ... Ed   You can do everything with JavaScript. After the textbox is updated through your web service, you can use another javascript function to validate the range of the input. Use the onchange fu...

Going back to a control after post back?
I have a page that is quite long, so after each post back, user need to scroll back to that control, is that a way to tell the browser to goto that specific control after postback? I have tried to put an anchor <a name='foo'> in front of that control and use asp.net's [Page.RegisterClientScriptBlock] to insert a javascript location.href = '#foo' into the page, however, it didn't work with Netscape7 because somehow NS stop show the page after that piece of javascript is inserted to the page.......here is an example.... <html> <head> <script language='JavaScrip...

getting focus back to the same control after post back
Hi friends!  How the control can be set focused on the same conrol after post back from where it was generated?thanks At the event of the control which causes Postback , add {        ControlID.Focus() } in this wayprotected void Page_Load(object sender, EventArgs e) {if (IsPostBack) {Control control = null; string ctrlname = Page.Request.Params["__EVENTTARGET"];if (ctrlname != null && ctrlname != String.Empty) { control = Page.FindControl(ctrlname); control.Focus(); } }   }   Note this will work for all...

IE Post Back & Firefox Post Back Issue!
Hi All Plase can you help. I just can not see what is wrong here.... I have some code that works fine in Firefox........but IE just ignores it no error it just does not do it My question is, does IE only do Postback execution when it is explicitly requested........ My code is a workaround cos I could not get this to work under a post back either and figured its my fault as i am still learning my code 'tries' to get a variable from a url..........on load the url loos like this 192.168.0.2/property.aspx?item=5 on post back (to the same page)  192.168.0.2/property.aspx?picname...

How to maintain form controls value after user control post back?
 hello experts, I have created filter grid in asp.net & C#.My form design has contains 3 dropdown controls and Filter grid(User control).Its working fine(filter), but one problem arise.the form controls are clear when i filter a grid(post back).I tried to reterive values using view state, hidden controls, i got only null values.Anyone please help, its urgent to me. Its my user control code.FilterGrid.aspx<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FilterGrid.ascx.cs" Inherits="FilterGrid" %><style type = "text/css&...

Forcing a post back and avoiding a post back! Please help!
I have a button in a page. The button  finds the matches of a term on code behind. brings the content and displays the content. The first click I want the button to go to the server and the next clicks till it reaches the end I want to be client side (no post back). When reaches the end , I want it to force a post back to move to next 100 records. any idea how to do it. I want to avoid using two buttons and client has asked me using one button only. Please help!...

Form Not Post Back due to Validation Controls
I have two textboxes and two requiredFieldValidators Controls with them when i submit form with text in two fields every thing work fine. and when i miss one textbox requiredfieldsvalidator error message appears as expected. but when i enter the text in both fields now my form is not posting back to server. i don't know why Help me urgently with a good solution thanks in advance.... Hi, do you happen to have SmartNavigation enabled? Also tell us your Framework version.Thanks,Teemu KeiskiFinland, EU Hai friends, Post your code so that i sould be easier to h...

where is the value saved of the form controls(such as textbox) in post backs?
hello! I have some puzzle in view state.I have just read an article in Msdn about view state.http://msdn2.microsoft.com/en-us/library/ms972976.aspx,It says, there are many stages in the life cycle of the page,and the Stage 2 is Load View State,the Stage 3  is Load Postback Data.In Stage 2 ,it says : During this stage, the view state data that had been saved from the previous page visit is loaded and recursively populated into the control hierarchy of the Page. And the Stage 3 is Load Postback data of the form controls, My first question is: what is the difference of the view stat...

Some form controls won't post back.
I've added some LinkButton controls in a FooterTemplate on a data grid. Unlike other control columns in my grid, these new link buttons make a call through WebForm_DoPostBackWithOptions instead of directly to __doPostBack.  Unfortunately, when I click one of my footer link buttons on the form, no postback is attempted.  I don't see any javascript errors or other indications that something is amiss on the form. There is also a button, outside of my grid, that has the same problem.  Strangely, a second button (also outside the grid) uses a simila...

Existance of forms prevents page from posting back correctlin in IE?
This is a bizarre error.  I have a couple of forms on my page, and when they are present, it will not postback correctly. It works fine all the time in Firefox, but the very existance of:             <form></form>            <form></form>prevents the page from assuming its updated state in IE.  If I remove the tags, things work fine.  Why might this be?  And please note that I simplified the problem as far as possible.  I kno...

How to prevent multiple form submissions (have a button do two post backs?)
I have a web form with a button which submits the entries of said form into a database via ADO.NET. The first thing the command does is disables the button however because the database sometimes is slow it takes a few seconds for the form to actually post back thus giving the user the ability to submit the form multiple times by quickly pressing the submit button. Is it possible to have a button do some code, do a post back, then do another block of code? Are there better ways to accomplish what I'm looking for? I am using Visual Studio 2005 Pro as my IDE. I have AJAX and the tool kit i...

Which Control Posted Back?
hi i need to know whick control make postback  EventTarget i think is the thing you are looking for... Request.Form.GetValues("__EVENTTARGET"); sivakl_2001: i need to know whick control make postback Look at the threads below:http://forums.asp.net/t/1147257.aspx http://forums.asp.net/t/1388983.aspx http://forums.asp.net/t/1074998.aspx Regards,Vinz"Code, Beer and Music" that's my way of being a programmer!How to get your Forum Question Answered | Blog | CodeASP.NET after the page load button  in your page make a postback if you click it ...

Web resources about - Prevent browser refreshes from posting back an already-posted-back form? - asp.net.presentation-controls

Resources last updated: 11/21/2015 2:43:38 AM