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
ropDownList id="DropDownList1" runat="server" AutoPostBack="True"></asp
ropDownList></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();
}
}
}