Weird Behavior on Drop Down

W

Wayne Dyer

I can duplicate this, so I know it's not something I'm imagining and
wonder if anyone else has seen it.

Take a page, put a drop down control on it, hook up the onChange event
handler to go get some data in the postback based on the selected index
that takes 3-4 seconds to return.

While the postback is occurring, click on the drop down box and *leave it
open* while the postback returns.

The page will come back blank and every single ASP.NET page after that
will also come back blank. HTML is sent to the browser, there's no
errors.

Anyone else seen this?

-dwd-
remove nospamplease- for email
 
A

Alvin Bruney [MVP]

Nope couldn't reproduce it. Here is my complete code

namespace WebApplication9

{

/// <summary>

/// Summary description for WebForm1.

/// </summary>

public class WebForm1 : System.Web.UI.Page

{

protected System.Web.UI.WebControls.Button Button1;

protected System.Web.UI.WebControls.DropDownList DropDownList1;

protected System.Web.UI.WebControls.TextBox TextBox1;


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

{

// Put user code to initialize the page here

DropDownList1.Items.Add("one");

DropDownList1.Items.Add("one2");

DropDownList1.Items.Add("one3");

}

#region Web Form Designer generated code

override protected void OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}


/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.Button1.Click += new System.EventHandler(this.Button1_Click);

this.DropDownList1.SelectedIndexChanged += new
System.EventHandler(this.DropDownList1_SelectedIndexChanged);

this.Load += new System.EventHandler(this.Page_Load);

}

#endregion

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

{

TextBox1.Text = "test";

}

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

{

System.Threading.Thread.Sleep(5000);

}

}

}

i pressed the button during the post back it worked everytime. post your
code if you still have that problem
 
W

Wayne Dyer

Nope couldn't reproduce it. Here is my complete code
[...]
i pressed the button during the post back it worked everytime. post your
code if you still have that problem

I did leave out one detail -- having autopostback on for the dropdown.

Here's some code that exhibits the problem, somewhat expurgated. :) The
stored proc just does a select * that takes about seven seconds). If you
choose an item from the dropdown, the postback starts. While the postback
is ongoing, open up the dropdown and leave it open. Don't know if the
ApplicationBlocks have anything to do with it either.

aspx:
<%@ Page language="c#" Codebehind="testpage.aspx.cs" AutoEventWireup="false" Inherits="TestApp.testpage" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>testpage</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">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<P>
<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="True"></asp:DropDownList></P>
<P>
<asp:Label id="Label1" runat="server">Label</asp:Label></P>
<P>
<asp:Button id="Button1" runat="server" Text="Button"></asp:Button></P>
</form>
</body>
</HTML>

aspx.cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;

namespace TestApp
{
/// <summary>
/// Summary description for testpage.
/// </summary>
public class testpage : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.DropDownList DropDownList1;

private void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
DropDownList1.Items.Add("test1");
DropDownList1.Items.Add("test2");
}
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
DataSet ds = SqlHelper.ExecuteDataset("Data Source=DBSERVER;Database=THEDB;UID=THELOGIN;PASSWORD=THEPASSWORD", "proc_sel_wait", null);
Label1.Text = ds.Tables[0].Rows.Count.ToString();
}
}
}
 
W

Wayne Dyer

Nope couldn't reproduce it. Here is my complete code
[...]
i pressed the button during the post back it worked everytime. post your
code if you still have that problem

I did leave out one detail -- having autopostback on for the dropdown.

Here's some code that exhibits the problem, somewhat expurgated. :) The
stored proc just does a select * that takes about seven seconds). If you
choose an item from the dropdown, the postback starts. While the postback
is ongoing, open up the dropdown and leave it open. Don't know if the
ApplicationBlocks have anything to do with it either.

I verified that the ApplicationBlocks don't have anything to do with it,
FWIW.

I'm just going to have to avoid using autopostback on DropDownLists.

-w-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top