RE: Problem with DropDownList & Frames
From: Bob N (bobn_at_guidesys.com)
Date: 02/10/04
- Next message: nfedin: "Re: alert calling to cell"
- Previous message: nfedin: "Re: ASP.NET Control Full DOM Name"
- In reply to: Amy Luu[MSFT]: "RE: Problem with DropDownList & Frames"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 10 Feb 2004 06:41:08 -0800
For the sake of completeness, here is the reply I got from the ASP.NET support folks:
Subject: SRX040209600450
*** Problem Description ***
Customer has an asp.net application with a dropdown menu and enable autopostback in
a frame
When users selects an item, it will do a postback to server. Before the postback
completes and the page refreshes, click the dropdown menu again
the frame page will become blank out.
Repro files:
Main.htm
<html><frameset cols="150,*"><frame name="contents" src=""><frame name="main" src="WebForm1.aspx"></frameset></html>
WebForm1.aspx:
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
Inherits="nastyBug.WebForm1" %><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" ><HTML><body MS_POSITIONING="GridLayout" bgColor="lime"><form id="Form1" method="post" runat="server"><asp:DropDownList id="DropDownList1" style="Z-INDEX: 101; LEFT: 29px; POSITION:
absolute; TOP: 27px" runat="server" Width="122px" AutoPostBack="True"><asp:ListItem Value="one">one</asp:ListItem><asp:ListItem Value="two">two</asp:ListItem><asp:ListItem Value="three">three</asp:ListItem><asp:ListItem Value="four">four</asp:ListItem></asp:DropDownList></form></body></HTML><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
*** Resolution *** Jul 18 2003 12:16PM Amyluu
Cause/Resolution:
This is a bug with Internet explorer 6.0 sp1.
The original bug, it is closed and moved to longhorn and customer accept
workaround
http://bugcheck/default.asp?URL=/Bugs/IEOESE/24828.asp
New bug: windows bug: 743465
http://bugcheck/default.asp?URL=/Bugs/WindowsOSBugs/743465.asp
In the meanwhile, we can workaround the problem by creating a client side onchange
event handler and delay the postback of a second.
A better sample suggest by earlb:
//need this using for the stringbuilder class
using System.Text;
private void Page_Load(object sender, System.EventArgs e)
{
DropDownList1.Attributes.Add("onchange","testdelay();");
Page.RegisterClientScriptBlock("dropdown1",CreateClientFunction(DropDownList1.Unique
ID));
}
private string CreateClientFunction(string str)
{
StringBuilder func = new StringBuilder();
func.Append("<script language=\"jscript\">");
func.Append("function testdelay(){");
func.Append("setTimeout(\"__doPostBack('" + str + "','')\", 1);");
func.Append("}");
func.Append("</script>");
return func.ToString();
}
====================================================================================
===============================================
Another code sample snippet (SRX020516602444) to workaround this problem, this puts
the script function at the before the starting HTML tag:
private void Page_Load(object sender, System.EventArgs e)
{
//create client site onchange event
DropDownList1.Attributes.Add("onchange","testdelay()");
WriteFunction(DropDownList1.UniqueID);
// Put user code to initialize the page here
}
private void WriteFunction(string str)
{
Response.Write("<script
language=\"jscript\">");
Response.Write("function testdelay(){");
Response.Write("setTimeout(\"__doPostBack('" +
str + "','')\", 1);");
Response.Write("}");
Response.Write("</script>");
}
VB.NET code Snippet:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
ListBox1.Attributes.Add("onchange", "testdelay()")
WriteFunction(ListBox1.UniqueID)
End Sub
Private Sub WriteFunction(ByVal str As System.String)
Response.Write("<script language=""jscript"">")
Response.Write("function testdelay()")
Response.Write("{")
Response.Write("setTimeout(")
Response.Write("""__doPostBack('DropDownList1','')"", 1);")
Response.Write("}")
Response.Write("</script>")
End Sub
Michael Graham, MCSD
Microsoft Developer Support
(980) 776-9966
mgraham@microsoft.com
Delighting our customers is our top priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please mail us at managers@microsoft.com. You can also contact my manager:
Jeremy Chapman
Middleware Team Manager
Office (469) 775-6360
Email - jeremyc@microsoft.com
Recent viruses on the Internet underscore the threat to all computer users and highlight challenges facing the entire industry in providing security that everyone needs to conduct business. I encourage you to sign up to receive automatic notification of Microsoft Security Bulletins by visiting http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/notify.asp. For more information on security, our Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit http://www.microsoft.com/security. We will be happy to answer any questions or provide assistance with your security needs.
- Next message: nfedin: "Re: alert calling to cell"
- Previous message: nfedin: "Re: ASP.NET Control Full DOM Name"
- In reply to: Amy Luu[MSFT]: "RE: Problem with DropDownList & Frames"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|