By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,827 Members | 2,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,827 IT Pros & Developers. It's quick & easy.

Problem with DropDownList & Frames

P: n/a
I have an ASP.NET web page -- several auto-post back DropDownLists that perform a query against a relatively large database (3 to 4 seconds delay) that repopulate a couple of datagrids, comboboxes and a chart (using dotnetCharting control) on the same page. This works just fine on its own. However, when I integrated the page into the rest of the site, it is then placed inside a frameset. Again, the page seems to work fine EXCEPT under the following circumstances

1. Select an item in the DropDownList (the query then starts running on the server
2. While the query is running, drop the list down again, but DON'T select anything
3. The query stops running, the code on the server side successfully completes, but the page in the frame does not plo
4. After this point, the page in the frame is 'blown' -- it will not replot again, unless you reload page that creates the frameset

This is completely repeatable. And it does not have a problem if it is not in a frameset

I have been coding for a long time, but am new to ASP.NET, so apologies if I have committed some obvious error. Thanks in advance for any ideas

Nov 18 '05 #1
Share this Question
Share on Google+
5 Replies

P: n/a
Hi Bob,
Thanks for posting in the community!
From your description, you encountered a strange problem which occured when
you try edit a dropdownlist after it has just been changed and posted back.
That'll cause the page blown, yes?
If there is anything I misunderstood, please feel free to let me know.

You've tried following the steps you provided and did found this problem.
This seems very strange and currently we're
doing further research on this issue so as to find some proper resource to
assist you. In addtion, here is an approach to workaround this problem if
you feel urgent to get rid of this problem:
We can set a flag when the dropdownlist is first time changed, then if next
time a user try to change it, we'll disable it so as to prevent it from
being droped down again. And here is a sample to show this workaround:
-----------------------aspx page----------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<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"
<script language=javascript>
function check()
if(document.all("hdFlag").value == "1")
document.all("lstMain").disabled = true;

function setflag()
document.all("hdFlag").value = "1";

<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<asp:Label id="lblMessage" runat="server"></asp:Label><input
type="hidden" id="hdFlag" runat="server" value="0" NAME="hdFlag"></td>
<asp:DropDownList id="lstMain" runat="server" AutoPostBack="True">
<asp:ListItem Value="ItemA" Selected="True">ItemA</asp:ListItem>
<asp:ListItem Value="ItemB">ItemB</asp:ListItem>
<asp:ListItem Value="ItemC">ItemC</asp:ListItem>
<asp:ListItem Value="ItemD">ItemD</asp:ListItem>
<select ></select>
-------------------code behind page class-------------------
public class DropDownListError : System.Web.UI.Page
protected System.Web.UI.WebControls.DropDownList lstMain;
protected System.Web.UI.HtmlControls.HtmlInputHidden hdFlag;
protected System.Web.UI.WebControls.Label lblMessage;

private void Page_Load(object sender, System.EventArgs e)

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)

private void InitializeComponent()
this.lstMain.SelectedIndexChanged += new
System.EventHandler(this.lstMain_SelectedIndexChan ged);
this.Load += new System.EventHandler(this.Page_Load);


private void lstMain_SelectedIndexChanged(object sender, System.EventArgs
lblMessage.Text = "SelectIndex is changed to " + lstMain.SelectedIndex +
"at " + DateTime.Now.ToLongTimeString();
hdFlag.Value = "0";

Please try putting the above sample into a frameset to see whether it works
for you. In the meantime, if you have any questions, please feel free to
post here.


Steven Cheng
Microsoft Online Support

Get Secure!
(This posting is provided "AS IS", with no warranties, and confers no

Nov 18 '05 #2

P: n/a
Yes, the page is 'blown' if you just drop-down the list while the previous request is processing-- you do not even have to make another selection. You run the same page, not in a frame, and the problem disappears. I might try the work-around in the short run, but I'd like to figure out what is causing this so I can avoid it in the future. Drop me a private email if you'd like the URL's that generate the problem

Thanks for any further help

Nov 18 '05 #3

P: n/a
Hi Bob,

What do you mean exactly when you said the page is "blown"? Can you give
more specific?

thank you,

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 18 '05 #4

P: n/a
The page comes back completely blank. I used one of my MSDN subscription support calls, and it turns out that this is a known bug with IE, and it is not scheduled to be fixed until the Longhorn release :(

They suggested a similar fix to Alan's, except rather than disabling control, they simply added a delay. I think I like Steve's answer better

Thanks to everyone for your help

Nov 18 '05 #5

P: n/a
For the sake of completeness, here is the reply I got from the ASP.NET support folks

Subject: SRX04020960045

*** Problem Description **

Customer has an application with a dropdown menu and enable autopostback in

a fram

When users selects an item, it will do a postback to server. Before the postback

completes and the page refreshes, click the dropdown menu agai

the frame page will become blank out

Repro files

<html><frameset cols="150,*"><frame name="contents" src=""><frame name="main" src="WebForm1.aspx"></frameset></html


<%@ 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 Amylu


This is a bug with Internet explorer 6.0 sp1.

The original bug, it is closed and moved to longhorn and customer accept



New bug: windows bug: 74346


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 clas

using System.Text

private void Page_Load(object sender, System.EventArgs e

DropDownList1.Attributes.Add("onchange","testdelay ();")

Page.RegisterClientScriptBlock("dropdown1",CreateC lientFunction(DropDownList1.Uniqu


private string CreateClientFunction(string str

StringBuilder func = new StringBuilder()

func.Append("<script language=\"jscript\">")

func.Append("function testdelay(){")

func.Append("setTimeout(\"__doPostBack('" + str + "','')\", 1);")



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 even

DropDownList1.Attributes.Add("onchange","testdelay ()")


// Put user code to initialize the page her

private void WriteFunction(string str



Response.Write("function testdelay(){")

Response.Write("setTimeout(\"__doPostBack('" +

str + "','')\", 1);")



VB.NET code Snippet

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As

System.EventArgs) Handles MyBase.Loa

'Put user code to initialize the page her

ListBox1.Attributes.Add("onchange", "testdelay()"


End Su

Private Sub WriteFunction(ByVal str As System.String

Response.Write("<script language=""jscript"">"

Response.Write("function testdelay()")



Response.Write("""__doPostBack('DropDownList1','') "", 1);")



End Sub

Michael Graham, MCSD

Microsoft Developer Support

(980) 776-9966


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 ma****** You can also contact my manager:

Jeremy Chapman

Middleware Team Manager

Office (469) 775-6360

Email - je*****

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 For more information on security, our Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit We will be happy to answer any questions or provide assistance with your security needs.

Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.