Jun 12, 2012, 8:28 PM
[CLOSED] Session management problem in IE8
Hi,
It appears that direct events are handled differently in IE8 and IE9 resulting in inconsistent session state. Please consider the code below. It works perfectly well for me in IE9. However, in IE8, the country selected is always empty until I refresh the SessionMain.aspx page using F5. What's the catch here? Please suggest a best practices approach or a workaround.
Thanks,
Vadym
SessionMain.aspx
It appears that direct events are handled differently in IE8 and IE9 resulting in inconsistent session state. Please consider the code below. It works perfectly well for me in IE9. However, in IE8, the country selected is always empty until I refresh the SessionMain.aspx page using F5. What's the catch here? Please suggest a best practices approach or a workaround.
Thanks,
Vadym
SessionMain.aspx
<%@ Page Language="C#" %>
<%@ Register TagPrefix="ext" Namespace="Ext.Net" Assembly="Ext.Net" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Ext.Net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
string country = HttpContext.Current.Session["Country"] as string;
if (!String.IsNullOrEmpty(country))
{
this.ComboCountries.SelectedItem.Text = country;
}
}
}
protected void ComboCountries_Select(object sender, DirectEventArgs e)
{
string country = e.ExtraParams["Country"].ToString();
HttpContext.Current.Session["Country"] = country;
Ext.Net.Panel activeTab = X.GetCmp<Ext.Net.Panel>("Tab1");
activeTab.Reload();
}
</script>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel runat="server" Frame="true" Height="120">
<Items>
<ext:ComboBox ID="ComboCountries" runat="server" Editable="false" Mode="Local" FieldLabel="Select country"
Width="260" SelectOnFocus="true" EmptyText="Select a country...">
<Items>
<ext:ListItem Text="Belgium" Value="BE" />
<ext:ListItem Text="Brazil" Value="BR" />
<ext:ListItem Text="Bulgaria" Value="BG" />
<ext:ListItem Text="Canada" Value="CA" />
<ext:ListItem Text="Chile" Value="CL" />
<ext:ListItem Text="Cyprus" Value="CY" />
<ext:ListItem Text="Finland" Value="FI" />
<ext:ListItem Text="France" Value="FR" />
<ext:ListItem Text="Germany" Value="DE" />
<ext:ListItem Text="Hungary" Value="HU" />
<ext:ListItem Text="Ireland" Value="IE" />
<ext:ListItem Text="Israel" Value="IL" />
<ext:ListItem Text="Italy" Value="IT" />
<ext:ListItem Text="Lithuania" Value="LT" />
<ext:ListItem Text="Mexico" Value="MX" />
<ext:ListItem Text="Netherlands" Value="NL" />
<ext:ListItem Text="New Zealand" Value="NZ" />
<ext:ListItem Text="Norway" Value="NO" />
<ext:ListItem Text="Pakistan" Value="PK" />
<ext:ListItem Text="Poland" Value="PL" />
<ext:ListItem Text="Romania" Value="RO" />
<ext:ListItem Text="Slovakia" Value="SK" />
<ext:ListItem Text="Slovenia" Value="SI" />
<ext:ListItem Text="Spain" Value="ES" />
<ext:ListItem Text="Sweden" Value="SE" />
<ext:ListItem Text="Switzerland" Value="CH" />
<ext:ListItem Text="United Kingdom" Value="GB" />
</Items>
<DirectEvents>
<Select OnEvent="ComboCountries_Select">
<EventMask ShowMask="true" />
<ExtraParams>
<ext:Parameter Name="Country" Value="item.getText()" Mode="Raw">
</ext:Parameter>
</ExtraParams>
</Select>
</DirectEvents>
</ext:ComboBox>
</Items>
</ext:Panel>
<ext:TabPanel ID="TabPanel1" runat="server">
<Items>
<ext:Panel runat="server" ID="Tab1" Title="Tab 1">
<AutoLoad Mode="IFrame" Url="~/SessionTab.aspx" ShowMask="true" />
</ext:Panel>
</Items>
</ext:TabPanel>
</form>
</body>
</html>
SessionTab.aspx<%@ Page Language="C#" %>
<%@ Register TagPrefix="ext" Namespace="Ext.Net" Assembly="Ext.Net" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="Ext.Net" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
string country = HttpContext.Current.Session["Country"] as string;
//X.Msg.Show(new MessageBoxConfig
//{
// Title = "Status",
// Message = "Reloading tab :: " + country,
// Buttons = MessageBox.Button.OK,
// Icon = MessageBox.Icon.INFO,
// AnimEl = this.ClientID
//});
this.DisplayCountry.Text = country;
}
}
</script>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" runat="server" Frame="true">
<Items>
<ext:DisplayField runat="server" ID="DisplayCountry" FieldLabel="You selected"></ext:DisplayField>
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by Daniil; Jun 13, 2012 at 8:43 PM.
Reason: [CLOSED]