DotNetAge:Dialog Cause Double PostBack

Jun 9, 2009 at 6:17 PM

The control DotNetAge:Dialog cause double postback when used with asp:ScriptManager

This rendered control is:
<span id="ctl00_dialog" title="Dialog" style="display:none;"><div style='margin:10px'><div style='vertical-align:middle;height:64px;padding-left:40px;background:transparent url() no-repeat;'></div></div></span>

This cause double postback in form_load method. See this forum:

To stop the double post-backs, just make sure all your ASP.NET controls (Image Buttons, Image Columns in grids, normal Images), all have a src attribute filled in - or otherwise, make them invisible. Otherwise, you will have phantom postbacks coming to haunt you when you least need it!

In case of the rendered DotNetAge:Dialog the tag src is not been showed.

I look at, and I am available for further clarification

Jun 9, 2009 at 7:44 PM

1.I could not open the link above.

2.I debug the code but i can see "Double PostBack" could show me a sample?

Jun 9, 2009 at 7:57 PM

As relief, I discovered that this problem can be circumvented by stating explicitly the content of the dialog box. See example below

<DotNetAge:Dialog Runat="server" ID="dialogo">
     <BodyTemplate />
 </DotNetAge: Dialog>

With the tag <BodyTemplate /> declared the ajax does not double postback because the contents of the source code of the rendered html tag is only <span> ...</ span> without having the tags <div> inside.
And to show the dialog box you can override the property with the value null BodyTemplate method as below:

         public void DialogShow ()
             this.dialogo = (DNA.UI.JQuery.Dialog) this.FindControl ( "dialog");
             foreach (DNA.UI.JQuery.DialogButton button in this.buttonList)
                 this.dialogo.Buttons.Add (button);
             this.dialogo.BodyTemplate = null;
             this.dialogo.AutoOpen = true;
             this.dialogo.EnableViewState = false;
             this.dialogo.CloseOnEscape = true;
             this.dialogo.ShowModal = true;
             this.dialogo.Title = this.titulo;
             this.dialogo.MessageText = string.join (Environment.NewLine, this.mensagem.ToArray <string> ());
             this.dialogo.DialogIcon = this.icon;

I look forward to the other tips

Jun 9, 2009 at 7:58 PM

This link contain:

ASP.NET double-postback bug strikes again!

A bug in ASP.NET has returned from the dead to haunt me today. I sat with one of my colleagues for over an hour to try and work out the issue to no avail. The problem was that the first Save worked fine - but I kept getting Optimistic Concurrency data errors when I saved the record for the second time (never the first). The big problem with ASP.NET bugs is that you tend to look in your code for the problem - that single attribute that shouldn't be there, the new code in our custom ObjectContainer data source or translation layer, that line of code that nullifies the value, that AJAX control not set up correctly. But there was none. After stepping through the code line by line, removing any Telerik Ajax Managers and Postback Panels -and anything remotely suspicious at - the problem was still there. After a bit more Divide and Konquering (DK for short) with CTL+E, CTL+C (the VS Shortcut for commenting out code), I finally found my old nemesis of the single empty image tag (which still exists in ASP.NET 3.5).

An example of this bug is detailed here:

It is also detailed here:

The issue occurs if you have any image tags rendered by your controls which have an empty source. As soon as the browser hits that <img src=""/> tag it does a refresh of the page. The main problem with this double postback is that the second run is NOT a postback - the Page.IsPostBack property is false - but I still have all my viewstate values. This issue is incredibly frustrating as the natural inclination is to look at controls causing partial postbacks - but you'd be looking in the wrong place. I had this issue in IE 6,7 and Firefox 2.

When I have some spare time, I'll look into how the problem occurs with Lutz Roeder's handy Reflector and find out who to tell to fix this reocurring issue :o)

To stop the double post-backs, just make sure all your ASP.NET controls (Image Buttons, Image Columns in grids, normal Images), all have a src attribute filled in - or otherwise, make them invisible. Otherwise, you will have phantom postbacks coming to haunt you when you least need it!

Jun 9, 2009 at 8:20 PM
Edited Jun 9, 2009 at 8:50 PM

How nice you are!Thx again.

I am checking the Dialog,When the BodyTemplte set to Null Dialog will build a default BodyTemplte i never use the image in default BodyTemplate but just using div's background attribute the div haven't "src" attribute at all so using background attribute will cause double postback too? It made me very confused.

Wa! finally i understand what had happed! It so horrible bug! i could not fixed it without your help!It will be a nightmare for me. OK the Dialog is works fine now.

Jun 9, 2009 at 8:45 PM

Yes, really. BodyTemplate is null when the dialog will build the default, but there is the problem. when the pattern is built it uses tags <div> </ div> that is causing conflict with the ajax scriptmanager. The PostBack is performed twice then. The link I mentioned the problem is caused by the tags are empty divs without content or by tags that do not contain the img tag declared. See example below.

1). Create a new project using you DJ Asp.Net Web Application Template.VSI.

******* Default.aspx
<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
    <asp:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true">
    <DotNetAge:Dialog runat="server" id="dialogo" />
    <asp:Button ID="Button1" runat="server" Text="Press to raise a simple PostBack and see a double post" />

******* Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace DJTemplateVSI
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

            string breakpoint = "please place a break point in this line, and see the DOUBLE postback";

Jun 9, 2009 at 9:12 PM

Please do me a favor, i am not sure i fixed it,could you get latest source code and rebuild it then to try again?

Jun 12, 2009 at 8:18 PM

Hi coordinator...

the problem has been solved. thankssss.


I would like to help you in this project. I can do to help him?

Jun 13, 2009 at 7:21 PM