RE: Problem with DropDownList & Frames

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bob N (bobn_at_guidesys.com)
Date: 02/10/04


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.

 



Relevant Pages

  • Re: VS 2003 Very Slow
    ... charges that are ordinarily incurred for support calls may be canceled ... This implies to me if you find a NEW problem you still pay $250 for the provilege of telling MS about their mistake. ... part is there if a bug tht is unrelated to an issue the call is about gets discovered or if customers raise several issues of which just one is a bug and the others are unrelated. ... But paying for customer support makes us pay for the privilege of de-bugging your software. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: IBM Quietly Pulling Releases of V10?
    ... Support says this happened because of issues being Stable and with Performance but couldn't provide anything more. ... Why is this a concern of mine: End of last year we upgraded to 10.00.FC5 and within 2 weeks had to rollback due to a rare, user un-reproducible bug. ... I installed this version in several customer instances and never had one crash related to the memory issue... ... before putting FC7 into production we/they decided to move to FC8 and we had no issues with it... ...
    (comp.databases.informix)
  • Re: Bugfix(59/8=APNIC), math jobs (was: JDEE/CGI/flashcards ...)
    ... It seems that your view of open-source is very different from mine. ... > totally free software who offers such rapid bug fixes. ... > customer support *only* to paying customers, and a pay rate in the ... > only provides free usage of some of my software but even free customer ...
    (comp.lang.lisp)
  • Re: 2.6.23-rc8-mm2: BUG near reiserfs_xattr_set
    ... I've got this BUG a few seconds after I logged in into Gnome desktop: ... unable to handle kernel NULL pointer dereference at virtual address 00000000 ... # Firmware Drivers ... # SCSI support type ...
    (Linux-Kernel)
  • SoftBUG on massive copying
    ... The system is running a vanilla 2.6.16.25 kernel, filesystems ... BUG: ... # ACPI Support ...
    (Linux-Kernel)