473,325 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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.getElementById("tb_prefix").focus();
and the server-generated _doPostBack function.

Any ideas?
Thanks

Nov 19 '05 #1
12 2901
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**********@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.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.DataSet
Dim sql As String
Dim myDbConnection As OleDbConnection
Dim myDbCommand As OleDbCommand
Dim myDbDataAdapter As OleDbDataAdapter

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

myDbConnection = New OleDbConnection(strConn_ReportCards)
myDbCommand = New OleDbCommand(sql, myDbConnection)
myDbDataAdapter = New OleDbDataAdapter(myDbCommand)

myDbDataAdapter.Fill(ds)

myDbConnection.Close()

lb_customers.DataSource = ds
lb_customers.DataBind()

End Sub

with strConn_ReportCards 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**********@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.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**********@hotmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.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="text/html"
ResponseEncoding="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(sender 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
I have no more clues. Maybe its time to see if there may be something
happening on the server. Try your test page in another application on the
same server for example. I'm stumped and I'm not a performance guru by any
means. The URLs I provided make for some interesting reading though. I have
a page that loads really slow myself and haven't figured out why yet. What
more can I say?

<%= Clinton Gallagher

"wizard04" <wi**********@hotmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
(same thing with EnableViewState="false")

Nov 19 '05 #11
Well, thanks anyway - I appreciate the effort :-)

Nov 19 '05 #12
To summarize, and hopefully get some more help with this:

I've been having trouble with the response time of aspx pages after
they are posted back to the server (I'm using vb.net). So far, it
looks like a server problem; I'd have to get the server admin to fix
it, so it would help to have a possible resolution before I ask him
(this won't be one of his priorities, unfortunately).

When I first GET a page, it works fine. When it POSTs back to the
server, they are processed by the server just fine, but for some reason
the browser receives only 70-90% of the page immediately and then waits
60 seconds for the rest of the page. To remove as many variables as I
can, I've been using a simple page to test with (code posted below).
Note that, with the test page, the browser seems to wait 60 seconds
before receiving anything (the previous page is still shown until
then). Here is what I've determined through my testing:

- I get the same results on both my WinXP computer (with both IE 6.0
and Firefox 1.0.7) and my Win2000 computer (with IE 5.5).
- They work fine locally (on my WinXP computer).
- I get the same results with the files both inside and outside of the
web application folder.
- It's not a problem with the page being recompiled since it works fine
on the first GET.
- With tracing turned on, I've found that the page is processed in less
than a second, so the problem seems to be after it is rendered but
before it is received/displayed by the browser.
- The file sizes are not large; for the aspx test page below, the
asp.net version is 932 bytes and the html version returned from the
server is 486 bytes.
- I get the same results with viewstate enabled and disabled.
- I get the same results with response.buffer set to true and to false.
- I get the same results coding the buttons using the format <input
type="submit" id="..." runat="server" value="..." onServerClick="...">
instead of the <asp:Button ...> format.
- A recent problem I've had may be related: response.redirect("...")
causes IE 6.0 to wait about a minute before displaying the page,
however it works fine for my other browsers. Though I still don't know
what causes this problem, I got around it by using these three lines of
code instead:
response.redirect("...", false)
response.flush()
response.end()

Here is the simple aspx test page I've been using, with only two button
controls:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" Trace="false" EnableViewState="false" %>
<% response.Buffer = true %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>test</title>
<script runat="server">
Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack then
response.Write("Not IsPostBack (" &
Request.RequestType & ")<br>")
else
response.Write("IsPostBack (" &
Request.RequestType & ")<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">
<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>

Any insights are welcome!

Nov 19 '05 #13

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

Similar topics

5
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...
0
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...
4
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...
1
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
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...
4
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)...
3
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...
5
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...
4
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.