Shannon Braun's Weblog
"Assembly Required"
« Gateway Connected DVD - here and gone
Latest post
DevCare Presentation - Designing Applica... »
The case of the double post back
Saturday, December 06, 2003 12:57:14 PM (Central Standard Time, UTC-06:00)
Let's just say you were cranking out HTML one day and instead of using the bgcolor attribute on a table to indicate the background color, you used background (which allows you to use an image for the background).
Would you think that it would create a double post back when you clicked submit on your form?
Well it does… this was a tough one to find in a large application we were working on. It had been around since at least April of this year (at least that's when it was brought to my attention). Months later when we were looking into performance and cleanup, we were able to find the source of the problem.
It was the background attribute on table that had a hex value for the color white (#FFFFFF). Here is the offending html here (it's highlighted in yellow):
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="DoublePostBack.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="
http://schemas.microsoft.com/intellisense/ie5
">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form2" method="post" runat="server">
<INPUT type="submit" value="Submit">
<br/><br/><br/>
<table
background="#FFFFFF"
runat="server" ID="Table1">
<tr>
<td>This is a table cell.</td>
</tr>
</table>
</form>
</body>
</HTML>
If you remove the background attribute from the code, the double post back is resolved, or you can also put a valid value (like an URL) into the attribute and it will work fine.
Posted in |
Comments [0]
Comments are closed.
Archives
August, 2008 (1)
April, 2008 (4)
March, 2008 (4)
February, 2008 (1)
January, 2008 (3)
December, 2007 (2)
October, 2007 (1)
September, 2007 (1)
June, 2007 (5)
May, 2007 (1)
April, 2007 (1)
March, 2007 (7)
February, 2007 (4)
January, 2007 (2)
December, 2006 (1)
November, 2006 (7)
October, 2006 (7)
September, 2006 (5)
August, 2006 (4)
July, 2006 (2)
June, 2006 (2)
May, 2006 (4)
April, 2006 (2)
March, 2006 (1)
February, 2006 (4)
January, 2006 (6)
December, 2005 (2)
June, 2005 (1)
May, 2005 (7)
April, 2005 (1)
March, 2005 (2)
February, 2005 (1)
January, 2005 (2)
December, 2004 (1)
November, 2004 (4)
October, 2004 (6)
July, 2004 (1)
May, 2004 (2)
April, 2004 (4)
March, 2004 (6)
February, 2004 (2)
January, 2004 (5)
December, 2003 (10)
November, 2003 (9)
October, 2003 (12)
January, 2003 (2)
Category Cloud
Architecture and Design (9)
Code (22)
Development (34)
Presentations (12)
TidByte (38)
Visual Studio .NET (12)
WPF (16)
Blogroll
David Chappell
David Ing
Harry Pierson
Rockey Lhotka
Scott Hanselman
Links
Home
MSDN
Microsoft Architecture Center
The MS Architect Journal
.NET Windows Forms
Asp.NET
Windows Communication Foundation
Microsoft Patterns/Practices
About
Sysknowlogy
Sign In