473,657 Members | 2,953 Online
Bytes | Software Development & Data Engineering Community
+ 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 2074
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>DropDown ListError</title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
<script language=javasc ript>
function check()
{
if(document.all ("hdFlag").valu e == "1")
{
document.all("l stMain").disabl ed = true;
}
}

function setflag()
{
document.all("h dFlag").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><inpu t
type="hidden" id="hdFlag" runat="server" value="0" NAME="hdFlag"></td>
</tr>
<tr>
<td>
<asp:DropDownLi st id="lstMain" runat="server" AutoPostBack="T rue">
<asp:ListItem Value="ItemA" Selected="True" >ItemA</asp:ListItem>
<asp:ListItem Value="ItemB">I temB</asp:ListItem>
<asp:ListItem Value="ItemC">I temC</asp:ListItem>
<asp:ListItem Value="ItemD">I temD</asp:ListItem>
</asp:DropDownLis t>
<select ></select>
</td>
</tr>
</table>
</form>
</body>
</HTML>
-------------------code behind page class-------------------
public class DropDownListErr or : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Drop DownList lstMain;
protected System.Web.UI.H tmlControls.Htm lInputHidden hdFlag;
protected System.Web.UI.W ebControls.Labe l lblMessage;

private void Page_Load(objec t sender, System.EventArg s e)
{
lstMain.Attribu tes.Add("onchan ge","setflag(); ");
lstMain.Attribu tes.Add("onmous edown","check() ;");
}

#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
InitializeCompo nent();
base.OnInit(e);
}

private void InitializeCompo nent()
{
this.lstMain.Se lectedIndexChan ged += new
System.EventHan dler(this.lstMa in_SelectedInde xChanged);
this.Load += new System.EventHan dler(this.Page_ Load);

}
#endregion

private void lstMain_Selecte dIndexChanged(o bject sender, System.EventArg s
e)
{
System.Threadin g.Thread.Sleep( 1000*4);
lblMessage.Text = "SelectInde x is changed to " + lstMain.Selecte dIndex +
"at " + DateTime.Now.To LongTimeString( );
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><frames et cols="150,*"><f rame name="contents" src=""><frame name="main" src="WebForm1.a spx"></frameset></html

WebForm1.aspx

<%@ Page language="c#" Codebehind="Web Form1.aspx.cs" AutoEventWireup ="false"

Inherits="nasty Bug.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:DropDownLi st id="DropDownLis t1" style="Z-INDEX: 101; LEFT: 29px; POSITION:

absolute; TOP: 27px" runat="server" Width="122px" AutoPostBack="T rue"><asp:ListI tem Value="one">one </asp:ListItem><a sp:ListItem Value="two">two </asp:ListItem><a sp:ListItem Value="three">t hree</asp:ListItem><a sp:ListItem Value="four">fo ur</asp:ListItem></asp:DropDownLis t></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(objec t sender, System.EventArg s e

DropDownList1.A ttributes.Add(" onchange","test delay();")

Page.RegisterCl ientScriptBlock ("dropdown1",Cr eateClientFunct ion(DropDownLis t1.Uniqu

ID));

private string CreateClientFun ction(string str

StringBuilder func = new StringBuilder()

func.Append("<s cript language=\"jscr ipt\">")

func.Append("fu nction testdelay(){")

func.Append("se tTimeout(\"__do PostBack('" + str + "','')\", 1);")

func.Append("}" )

func.Append("</script>")

return func.ToString()

=============== =============== =============== =============== =============== ========

=============== =============== =============== =

Another code sample snippet (SRX02051660244 4) to workaround this problem, this puts

the script function at the before the starting HTML tag

private void Page_Load(objec t sender, System.EventArg s e

//create client site onchange even

DropDownList1.A ttributes.Add(" onchange","test delay()")

WriteFunction(D ropDownList1.Un iqueID)

// Put user code to initialize the page her

private void WriteFunction(s tring str

Response.Write( "<script

language=\"jscr ipt\">")

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.EventArg s) Handles MyBase.Loa

'Put user code to initialize the page her

ListBox1.Attrib utes.Add("oncha nge", "testdelay( )"

WriteFunction(L istBox1.UniqueI D

End Su

Private Sub WriteFunction(B yVal str As System.String

Response.Write( "<script language=""jscr ipt"">"

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*****@microso ft.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******@micros oft.com. You can also contact my manager:

Jeremy Chapman

Middleware Team Manager

Office (469) 775-6360

Email - je*****@microso ft.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
3217
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 that I could externalize my JavaScript, but that will not be practical throughout this application. Is there any way to get around this issue? Xalan processor. Stripped down stylesheet below along with XHTML output. <?xml version='1.0'?>...
3
10405
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... javascript errors :) I can catch errors coming from website that does not use frames using : private void NavigateComplete(object sender,AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e) {
8
1998
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" up in the right upper corner of the browser. I have an XP and had just installed XP Service Pack II...against my better judgment. Please help. Thanks.
0
892
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 displayed in a frame. Problem: When I enter the value in the textbox and then try to select anything from the dropdownlist , the page gets blocked(blank page and no links in the other frames work)until refresh is pressed. The strange thing
1
2195
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 be brought back to a minimum. The application suffered from relatively large screens. A typical aspx page was 500 Kbyte so page load times were in the order of 40 - 50 seconds. After unsufficient loading improvement using .net caching
4
3834
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 12456 another description $123.01 But when the text is rendered the white space is removed so it looks like this:
8
4796
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 have a web page divided into two major segments, with the top segment fixed and the bottom segment allowed to scroll, thus giving the look of frames without frames. I also have anchors so that users can click on a letter of the alphabet to jump...
0
2396
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 View I want the form populated from there profile on the sql server. The code to save the profile works fine. But when the user logs back in they data doesn't load back to the form. The multiview is located inside the LoginView's Logged-In View ....
3
2362
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 Edit. I have been trying to hunt down a viable soltion to this, seems that many people out there have similar issues and the ...SelectedItem.Value or SelectedValue is not returning what is actually being selected by the end user. So the simple question...
0
8384
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8302
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8499
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.