Page with AJAX controls posts back twice to the server

I have a form containing three AJAX UpdatePanels, two of which contain a pair of listboxes and a pair of buttons, with the third one containing a pair of radio buttons in a radiobutton list and either three CascadingDropDown lists or two CascadingDropDown lists and a textbox depending on which radio button is selected.  The only other control on my form is a button to submit the information on the form to the server.

One thing I've noticed is the information gets posted back to the server twice when the button is clicked.  This causes a duplicate record to be written to two tables and a SQL exception being thrown when it tries to write a duplicate record to a third table since it violates that table's primary key constraint.  At first, I thought the cause might've been due to the submit button being contained in the third UpdatePanel I mentioned, so I removed it from there and placed it by itself ... but the problem still occurs.  One other thing I've noticed is that when data for one of the UpdatePanels is to be updated via a postback to the server, the other two UpdatePanels act as if they're also being posted back to the server; in other words, all three panels noticeably flicker simultaneously.  I have a sneaking suspicion this may somehow tie into my entire page being posted back twice when the submit button is clicked, but I'm not at all sure.

What can I do to prevent my page from being posted back twice?


If at first you don't succeed, call in an airstrike.
0
AllBruAnd
7/23/2007 4:15:11 AM
asp.net.ajax-ui 9760 articles. 0 followers. Follow

2 Replies
811 Views

Similar Articles

[PageSpeed] 24

Hi,

any sync postback at the server side is almost identical to regual postback including:

- all control values are posted to the server
- Viewstate is transferred to the server and back

The most important difference is in the rendering phass: only update panels are rendered and their content transferred to the client

So, you must design your application in such a way, that removing all update panels will not break server logic.  UpdatePanels reduce flickering, but they don't change how server code process data.

-yuriy

0
ysw
7/23/2007 9:45:06 AM

I think there a couple things that can cause this... I think ImageButtons can get rendered as "Submit" buttons, and have a __doPostBack call attached to their OnClick, which seems to make a double postback. Also, I think a button has a UseSubmitBehavior property... try setting that to false.

0
valenumr
7/23/2007 9:55:19 AM
Reply:

Similar Artilces:

AJAX Master Page, AJAX Web Form and AJAX Client Control Question?
I gues to get the ball rolling I have VS 2008 and I am creating ASP.NET websites. I have programmed with VS 2005 and always had to add AJAX features by hand. Now in VS 2008 you have new templates AJAX Master Page, AJAX Web Form, AJAX Client Behavior, AJAX Client Control, AJAX Client Library, AJAX-embeded WCF Service On these three templates AJAX Master Page, AJAX Web Form and AJAX Client Control. What makes them different from normal templates? Is it just a matter of adding the script manager to the page or is using a AJAX Master Page have a huge benefit over doing individual pages? I have...

BUG: Server.Transfer from a non AJAX page to an AJAX page in a different folder
Hi folks,I have some code that was working fine with a previous version of Atlas (v2.0.50727) but when we upgraded it to the release version it causes a HttpUnhandledException to be thrown with a stack trace as follows:at System.Web.UI.Page.HandleError(Exception e)   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)   at System.Web.UI.Page.ProcessRequest()   at System.Web...

ajax or not to ajax.
Heres a strange one for you. I have a textbox, a button and a gridview on a page. I enter some search text which returns 500 odd records in under a second. When i wrap the gridview in an updatepanel, set its update mode to "conditional" and the trigger to the button the page can take 2-4 seconds to render. I think the problem is down to page redering some how as my progress indicator stops at around the same time as the normal postback would appear. I have also noticed this very behaviour and have come to the conclusion that in cases like this it is better to hand code a XMLHttp...

My AJAX is not AJAXing!
Hi, I was having trouble with a new AJAX enabled code so I tried to just to do a simple test page. I did the simple Label control with button example covered in this tutorial http://www.asp.net/learn/ajax/tutorial-01-cs.aspx I'm having the same problem. Functionalitw-wise it works but the page is refreshing and flickering. That means it's not the code but maybe my set up. I'm using VisualStudio 2005 and the application is currenty .NET 2.0. In VS.NET, I do see the AJAX controls though. What could this be?Thanks,Sam did you install the Ajax extensions? Now, it's AJAXing!...

Why My Ajax Enabled Page Do Post Back?!
 Hi There.I Have My Ajax Anabled Project Which Works Fine In My PC.But When I Upload That It Doesn't Work.What's The Matter?Thanx In Advance Hi, Please check this link to configure an existing ASP.NET application. http://www.asp.net/learn/ajax-videos/video-81.aspx If you encountered the client 'sys' error meanwhile, please configure the web.config:     <httpHandlers>      <remove verb="*" path="*.asmx"/>      <add verb="*" path="*.asmx" validate=...

To AJAX, or not to AJAX?
Some body suggested to me to use AJAX. I figured it's not the brand name detergent nor the Dutch city. So here is what I have and please tell me if it ca be done with ajax, and perhaps point me to some examples, etc. The page contains several GridViews and FormViews that display data using several data calls. (Yeah, there is my first issue. Need to figure out how to cash all that.) This is an application that track work orders, so the top most FV has the user info and summary information of the work order. It is editable and so far it works well. There is also another set of infroamt...

System.Web.UI.Page and Ajax.net
 İ use .net 2005 and ajax.net.Normally i use System.Web.UI.Page,my webpage is working.But in here we use other page that extends System.Web.UI.Page.if i extend my class to our  webpage my ajax.net isn't  working. My error explanation is: sys.webfrom.pagerequestmanagerparserErrorException:the message received from the server could not beparsed.Common causes for this error are when the response is modifies by calls to Response.write(),response filters,httpmodules,or server trace is enabled. Details:Error parsing near'itle||Untitled PAge|<script language=J...

Does AJAX Post all form data back to server?
Hi allRecently, I am studying Asp.net AJAX and find one question. Please see below code excerpt:<form id="form1" runat="server">  Maxium: <asp:TextBox  runat=server ID=maxValue Text=2500 /> <br />   <ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />            Result: <asp:UpdatePanel runat =server ID="ResultPanel">                 &nb...

Server response is not post to html Ajax page
I'm Using ASP.net to do AJAX but I've some problems. Here is my calcul.aspx page protected void Page_Load(object sender, EventArgs e) { calculs(); } private void calculs() { //Get the request query string n1 = Request["n1"].ToString(); string n2 = Request["n2"].ToString(); string operation = Request["operation"].ToString(); int res=0; if(operation.Equals("add")) { res=int.Parse(n1)+int.Parse(n2); } string strXmlval...

Ajax events not working until page posts back
 I have a page that uses an update panel to refresh content.  The problem I am having is that buttons that are inside of the update panel never seem to return from the call they are making when the page loads the first time, but if I click a button outside of the update panel and post the whole page back, the buttons inside of the update panel work fine after that.  Has anyone ever heard of this happening and have any idea what I may be doing wrong?  The update panel is definately going through the events and updating the database etcetera but it just hangs when it finish...

How to maintain page scroll position after clicking AJAX Rating control in AJAX ModalPopup
HiHow can i maintain page scroll position.I have placed a AJAX Rating Control in ModalPopup Extender, but when i click on rating control in modalpopup extender my page scroll position is changing it is moving to the top of page.I have used maintainScrollPositionOnPostBack ="true"  for pages but it does not work Can any help to solve this problem.regardsprashant  Try this. "Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us."  Hi Thanks for your reply.Rating1.Attributes...

How to do post back in a dynamically created user control [provided that update panel is in the master page of the page where user control is added] {B/C of FileUpload Control}
I have a register my scriptmanager and place the update panel around contenttempalte for my pages int the master page. Now in one of my pages i am adding some user controls dynamically. In two of my user user controls I have FileUpload control which will not work under partial post back. So I want's full postback for them How could I do that {Provided that i am on the user control,which is inside the page ,and page have the contenttemplat...

How to instantiate an AJAX control inside a custom AJAX control
Hi I want to include a ToggleButton control inside a custom AJAX control.  How can I instantiate an instance of the ToggleButton in my Javascript?  If I create an instance of the ToggleButton in C# code, how could the Javascript pick it up?  Thank you,  ltlwinger   http://msdn.microsoft.com/en-us/library/bb397487.aspx Final Answer.Good Luck this._pin = $create(AjaxControlToolkit.ToggleButtonBehavior, { 'id': this.get_id() + "_ToggleButton", 'CheckedImageUrl': 'images/collapse.jpg', 'UncheckedImageUrl': '...

Page and Control Flashing Using AJAX Control Toolkit Controls
Page and Control Flashing Using AJAX Control Toolkit Controls I'm using IE7 and the ASP.NET AJAX Control Toolkit.  I'm using two controls -- Accordion and CollapsiblePanelExtender.  I'm actually using 2 CollapsiblePanelExtenders, and the Accordion control is inside one of the panels for the CollapsiblePanelExtender (see the code below). The problem I'm seeing is that when I click an Accordion pane to open/close it or click the CollapsiblePanelExtender panel to open/close the panels, the controls and page flash while the animation is in progess.  Everything el...

Web resources about - Page with AJAX controls posts back twice to the server - asp.net.ajax-ui

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Tarago bushfire brought under control
A bushfire which burnt out close to 120 hectares near Tarago on Monday afternoon has been brought under control.

Hyundai recalls Elantra to fix stability control system
Filed under: Recalls , Hyundai , Safety , Sedan , Budget Starting in February Hyundai will recall 155,000 Elantras from the 2011 and 2012 model ...

Using Amazon Echo to control your home? There's a minor change you need to know about
It may be a minority who use the Amazon Echo to control home automation, in fact it likely is. But there are folks who do it, and it can, and ...

I've heard a rumor from Ground Control/Oh no, don't say it's true....
"David Bowie, the infinitely changeable, fiercely forward-looking songwriter... died on Sunday, two days after his 69th birthday...."

Sean Penn Interviews El Chapo for Rolling Stone… SHOCK: Magazine Gives Fugitive Drug Lord Editorial Control ...
Sean Penn interviewed fugitive Mexican drug lord Joaquín Guzmán Loera, known as “El Chapo,” who was captured and returned to prison Friday, for ...

This IBM programmer can control a BB-8 droid from 'Star Wars' with his mind
... decided to take Sphero's excellent "Star Wars: The Force Awakens" BB-8 app-powered droid and take it a step further with the ability to control ...

Is There A Gun Control Issue Chris Christie Hasn't Flip Flopped On?
... while they are campaigning for a higher office, but I'm not sure if I've ever seen a man change his entire position on one issue (gun control) ...

Ground Control to David Bowie: You Really Made the Grade
Among real space explorers, few songs have resonated as powerfully as David Bowie’s iconic 'Space Oddity.'

Birth control for men comes down to flipping a switch
Birth control for men still tends to be divided between condoms (which aren't always fun or reliable) and more drastic surgical procedures like ...

Resources last updated: 1/11/2016 11:51:58 PM