Jul 14, 2010, 3:33 PM
[0.8.2] Multiple WindowUnload for GridView in UpdatePanel
When start this page and select different items in GridView,
<WindowUnload Handler="alert('WindowUnload');" /> fires 2x, 3x, 4x, ... times.
<WindowUnload Handler="alert('WindowUnload');" /> fires 2x, 3x, 4x, ... times.
<%@ Page Language="C#" AutoEventWireup="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="TestWebApplication" %>
<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>
<script runat="server">
public class Driver
{
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
System.Collections.Generic.List<Driver> drivers = new System.Collections.Generic.List<Driver>();
Driver driver = new Driver() { Name = "Driver 1" };
drivers.Add(driver);
driver = new Driver() { Name = "Driver 2" };
drivers.Add(driver);
driver = new Driver() { Name = "Driver 3" };
drivers.Add(driver);
driver = new Driver() { Name = "Driver 4" };
drivers.Add(driver);
gvDetail.DataSource = drivers;
gvDetail.DataBind();
}
}
protected void gvDetail_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
{
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head" runat="server">
<title>RControl</title>
</head>
<body id="MasterBody" runat="server">
<form id="Form" runat="server">
<asp:ScriptManager ID="ASPScriptManager" runat="server" AsyncPostBackTimeout="1000" EnableScriptGlobalization="True">
</asp:ScriptManager>
<ext:ScriptManager ID="EXTScriptManager" runat="server" Theme="Default">
<Listeners>
<WindowUnload Handler="alert('WindowUnload');" />
</Listeners>
</ext:ScriptManager>
<ext:ViewPort ID="ViewPort" runat="server" StyleSpec="width:100%; height:100%;">
<Body>
<ext:Panel ID="Panel" runat="server" Header="False" BodyBorder="False" Border="False" StyleSpec="width:100%; height:100%;">
<Body>
<asp:UpdatePanel ID="TabGPSGridsUpdatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView runat="server" ID="gvDetail"
ForeColor="#333333" GridLines="None" CellPadding="4" Width="100%" HorizontalAlign="Left"
onselectedindexchanging="gvDetail_SelectedIndexChanging"
EnableModelValidation="True">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" Height="20px" />
<Columns>
<asp:CommandField SelectText="Карта" ShowSelectButton="True">
<ItemStyle Width="90px" />
</asp:CommandField>
</Columns>
<FooterStyle BackColor="#999999" ForeColor="White" Height="20px" />
<HeaderStyle BackColor="#999999" ForeColor="White" Height="20px" />
<PagerSettings Mode="NumericFirstLast" PageButtonCount="5" />
<PagerStyle BackColor="#284775" ForeColor="White" Height="20px" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" Height="20px" />
<SelectedRowStyle BackColor="#E2DED6" ForeColor="#333333" Height="20px" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</Body>
</ext:Panel>
</Body>
</ext:ViewPort>
</form>
</body>
</html>
Last edited by geoffrey.mcgill; Jul 29, 2010 at 6:03 AM.