Problem with DropDownList & Frames

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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_SelectedIndexChanged);
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.)
 
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
 
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.
 
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
 
Back
Top