473,626 Members | 3,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

postback causes delay

I have a drop-down list, populated from a database, a few text boxes,
and a few buttons on a page. The ddl is set to autopostback.

For some reason, whenever a postback happens (when an item in the ddl
is selected or a button is clicked) the page is processed immediately
and is sent back to the browser, but after the browser displays the
first 50-75% of the page, it stops for about 60 seconds before
displaying the rest.

As far as I can tell it's not a server problem, because I set
trace=true and the page was processed in less than a second. However,
the same thing happens in IE6.0 and Firefox 1.0.7 on my WinXP computer
and in IE5.5 on my Win2000 computer, so I'm not sure where the problem
is. The only client-side code is javascript to set the focus to the
first textbox: document.getEle mentById("tb_pr efix").focus();
and the server-generated _doPostBack function.

Any ideas?
Thanks

Nov 19 '05 #1
12 2920
Correction: it's a listbox, not a drop-down list

Nov 19 '05 #2
In ASP we used to solve this problem by setting Response.Buffer = true so
all controls and contents of the page would be processed before the page was
displayed. I suspect the is a control that is giving the Response object a
hard time. How are you populating the ListBox for example? Kill ViewState
and test the page and so on.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee. com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"wizard04" <wi**********@h otmail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Correction: it's a listbox, not a drop-down list

Nov 19 '05 #3
I'm populating the listbox when the page first loads, when an item is
removed from the list (one of the buttons), or when an item is added or
updated (another button). I use a function as follows:

Sub doDataBind()

Dim ds As New System.Data.Dat aSet
Dim sql As String
Dim myDbConnection As OleDbConnection
Dim myDbCommand As OleDbCommand
Dim myDbDataAdapter As OleDbDataAdapte r

sql = _
"SELECT * " & _
"FROM Customer " & _
"ORDER BY LastName, FirstName, UserName"

myDbConnection = New OleDbConnection (strConn_Report Cards)
myDbCommand = New OleDbCommand(sq l, myDbConnection)
myDbDataAdapter = New OleDbDataAdapte r(myDbCommand)

myDbDataAdapter .Fill(ds)

myDbConnection. Close()

lb_customers.Da taSource = ds
lb_customers.Da taBind()

End Sub

with strConn_ReportC ards being the connection string to my Access
database.

I just tried turning off viewstate in the @Page directive, but that
didn't help.

Nov 19 '05 #4
Actually, the listbox isn't even populated now that viewstate's off.

Nov 19 '05 #5
I meant to turn off ViewState just to see what can be observed. I see you
need to get out of the habit of using the * metacharacter with your Select
statement. Use the actual names of the fields to avoid a performance penalty
when hitting the database. What if your table has a bunch of fields? The
metacharacter will select each field in the table and must determine which
field will or will not be used in the rest of the query.

The rest of your code looks fine. Then, if the contents of the ListBox do
not need to be changed with each PostBack I would suggest learning how to
cache the contents of the ListBox. That should about do it other than the
last suggestion to dump JET and use SQL Server as performance is much much
much better. How many other pages may be hitting that same database at the
same time? JET is a monolithic file. All requests get processes single file
injun style which I hear is no longer nice to say but I sure wonder where
the saying come from :-)

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee. com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
"wizard04" <wi**********@h otmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Actually, the listbox isn't even populated now that viewstate's off.

Nov 19 '05 #6
While doing some housekeeping I came upon this resource by David Hayden [1].

<%= Clinton Gallagher

[1] http://davidhayden.com/blog/dave/arc...8/24/2439.aspx

"wizard04" <wi**********@h otmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Actually, the listbox isn't even populated now that viewstate's off.

Nov 19 '05 #7
Thanks Clinton, I'll try out your suggestions :-)

Nov 19 '05 #8
I decided to make a simple test first. The following code (only two
buttons) has the same problem:

<%@ Page Language="VB" ContentType="te xt/html"
ResponseEncodin g="iso-8859-1" Trace="false" EnableViewState ="true" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>test</title>
<script runat="server">
Sub Page_Load(sende r As Object, e As EventArgs)
If Not IsPostBack then
response.Write( "Not IsPostBack<br>" )
else
response.Write( "IsPostBack<br> ")
end if
End Sub
Sub doA(sender As Object, e As EventArgs)
response.Write( "A Clicked<br>")
End Sub

Sub doB(sender As Object, e As EventArgs)
response.Write( "B Clicked<br>")
End Sub
</script>
</head>
<body>
<form runat="server" id="theForm">
<asp:Button ID="btn_A" runat="server" Text="A" OnClick="doA"/>
<asp:Button ID="btn_B" runat="server" Text="B" OnClick="doB"/>
</form>
</body>
</html>

Nov 19 '05 #9
(same thing with EnableViewState ="false")

Nov 19 '05 #10

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

Similar topics

5
46007
by: Matt | last post by:
I always see the term "postback" from ASP book, but I am not sure if I fully understand the meaning. Here's my understanding so far, please correct me if any mistakes. Here's a typical html form: <form action="process.asp" method="post"> 'GUI code </form> "postback" action happens when the user click the submit button, that means
0
1543
by: Lecture Snoddddgrass | last post by:
Hi, I noticed that my WinForms app was taking a while to start up. I stepped through the code to find out which line was causing the delay. The delay is occurring within one of my UserControls whose designer-generated InitializeComponent() method instantiates a web browser control and eventually calls EndInit() on it. It's that EndInit() call that takes several seconds to complete. What's odd is that my application makes extensive use...
4
5640
by: Mike Szanto | last post by:
I have an intranet application where some pages display large tables of editable data. I've designed the page to operate like Microsoft Access where the user can move from cell to cell and as they change rows it checks to see if edits have been made and automatically saves the changes to that row in our SQL database. Here's my challenge: Everytime the information is posted back to the server, the page is reloaded at the client(normal asp...
1
1327
by: szabelin | last post by:
Hello, what is the page directive (was it meta something?) that causes page go call the server at predefined intervals? I used to have a link to sample code but it's broken now. thanks
0
1546
by: Xavier Osa | last post by:
Hi, I have an ASP.Net web page that you can download a file. As Fergunson's problem, it prompts twice dialog boxes only if I select Open button. If I select Save button, it prompts once. I'm using W2000KS & IE6 sp1 & VS.NET 2003. If I change method="post" by method="get" form attribute, it works fine.
4
2349
by: Dan =o\) | last post by:
Hi guys, in the scenario where a user fills in a form, and clicks on a button to Save, there's a period of waiting (the slower the connection between client and server, the longer the delay) where the user may be oblivious and could say, press the button twice, or even fill in some more data on the form... When the postback completes, any data entered in during this delay is lost. How do I, when the user clicks on a button, process...
3
2571
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes a postback to occur which in turn triggers a sub in a user control... Error: Argument not specified for parameter e of Public Sub UploadDate(Sender As
5
1995
by: Bjorn Sagbakken | last post by:
Hello I have just migrated from VS 2003 to VS 2005, and .NET framework 1.1 to 2.0 I am at the end of debugging and fixing stuff. Now there is one error I just cannot find a solution to: On some pages I have applied a small client-script to trap the enter-key beeing pressed and re-route this action. With the new version this little script still works, it traps the enter-key. BUT it causes postback-errors on many other .NET control,...
4
1707
by: =?Utf-8?B?RGFpc3k=?= | last post by:
I have a couple of listboxes and dropdownlist on a page and they are postback enabled. The problem is whenever user clicks the box the page brings to the top. is there anyway to delay the postback till all the listboxes and dropdown selections are made then the data is postback to server when the submit button is clicked? Thanks for any response in advance!
0
8265
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
8196
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
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8364
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,...
0
7193
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5574
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4092
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...
1
2625
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
1511
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.