473,466 Members | 1,364 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with DropDownList & Frames

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

Bob
Nov 18 '05 #1
5 2063
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" >
<HTML>
<HEAD>
<title>DropDownListError</title>
<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"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language=javascript>
function check()
{
if(document.all("hdFlag").value == "1")
{
document.all("lstMain").disabled = true;
}
}

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

}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="500" align="center">
<tr>
<td>
<asp:Label id="lblMessage" runat="server"></asp:Label><input
type="hidden" id="hdFlag" runat="server" value="0" NAME="hdFlag"></td>
</tr>
<tr>
<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>
</asp:DropDownList>
<select ></select>
</td>
</tr>
</table>
</form>
</body>
</HTML>
-------------------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)
{
lstMain.Attributes.Add("onchange","setflag();");
lstMain.Attributes.Add("onmousedown","check();");
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}

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

}
#endregion

private void lstMain_SelectedIndexChanged(object sender, System.EventArgs
e)
{
System.Threading.Thread.Sleep(1000*4);
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.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #2
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

Bob
Nov 18 '05 #3
Hi Bob,

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

thank you,
Amy

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

Nov 18 '05 #4
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

Bob
Nov 18 '05 #5
For the sake of completeness, here is the reply I got from the ASP.NET support folks

Subject: SRX04020960045

*** Problem Description **

Customer has an asp.net 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

Main.ht

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

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

workaroun

http://bugcheck/default.asp?URL=/Bugs/IEOESE/24828.as

New bug: windows bug: 74346

http://bugcheck/default.asp?URL=/Bug...Bugs/743465.as

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

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 even

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

WriteFunction(DropDownList1.UniqueID)

// Put user code to initialize the page her

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.Loa

'Put user code to initialize the page her

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

WriteFunction(ListBox1.UniqueID

End Su

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

mg*****@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 ma******@microsoft.com. You can also contact my manager:

Jeremy Chapman

Middleware Team Manager

Office (469) 775-6360

Email - je*****@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/tre...tin/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.

Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
3
by: dricks dr | last post by:
Hi, I'm using the AxWebBrowser Control from microsoft in a C# application. It works fine, but i have many problems to hide the javascript error windows that appear when u visit a website with......
8
by: David | last post by:
This is something I had never seen before. On an aspx page, upon pressing a link button for which I have an event handler in the code behind, the screen shows nothing but a line that says "true"...
0
by: Vishwas | last post by:
Background: We are having a web form with textbox and a dropdownlist. Both of them are having autopostback enabled for textchanged and selectedIndexChanged respectively. This aspx is being...
1
by: Wim | last post by:
Hi Everyone, I'm trying to speed up a Asp.net 1.1 applications' performance. The application needs to run in an environment with little bandwith and therefore pagesizes and roundtrip times shoud...
4
by: Jeff | last post by:
Help.... I have formatted a lsit of strings to add to a dropdownlist to shows three colums: id, description and price. i.e. 123 description here $12.95...
8
by: knoxautoguy | last post by:
This problem has consumed a lot of my time, and I'm aftraid someone will tell me that my whole approach to this objective is wrong; however, I would like to know if there is a way to do this. I...
0
by: Jacob Donajkowski | last post by:
Once the user logs in I want to have the users switch from the Roster View to the Profile View and enter their profile infomation and save it. Then the next time they login and go to the Profile...
3
by: RPhlb | last post by:
This is my first post, so excuse me if I don't get this right the first time. I have an issue where when I use DropDownList I only get the first, or "SelectedValue" back when I update a GridView...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.