Getting the following error randomly on my .aspx that involves javascript and AJAX. It seems to be happening if I don't run the process on the page for 10-15 minutes. After I get one time out it usually works the next try and increasingly gets faster every time after that until it sits idle again.
This page is using a pretty simple stored proc to populate a gridview that is inside an updatepanel.
I get a popup box with the following error:
Sys.WebForms.pageRequestManager TimeoutException : the server request timed out
Code:<%@ Page Language="VB" AutoEventWireup="true" CodeFile="Cust_CM.aspx.vb" Inherits="_Default" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>A/R Credit Memos</title> <link href="StyleA.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Panel ID="Panel2" runat="server" Height="50px" Style="text-align: right" Width="608px"> <div style="float: left; width: 200px; height: 100px; text-align: left"> <br /> <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Size="Larger" Text="Credit Memos" Width="192px"></asp:Label><br /> </div> <asp:Panel ID="Panel1" runat="server" Height="50px" Width="400px" style="text-align: left"> <br /> <br /> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> Generating Data...<br /> <img src="pleasewait.gif" /> </ProgressTemplate> </asp:UpdateProgress> </asp:Panel> </asp:Panel> <br /> <br /> <table style="width: 576px" > <tr> <td style="width: 114px"> <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Invoice Date:" Width="96px"></asp:Label></td> <td style="width: 175px"> <asp:TextBox ID="txtInvoiceDateFrom" runat="server" Width="96px"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtInvoiceDateFrom"> </cc1:CalendarExtender> </td> <td style="width: 15px"> <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="To"></asp:Label></td> <td> <asp:TextBox ID="txtInvoiceDateTo" runat="server" Width="96px"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtInvoiceDateTo"> </cc1:CalendarExtender> </td> </tr> <tr> <td style="width: 114px"> <asp:Label ID="Label3" runat="server" Font-Bold="True" Text="Project Number" Width="112px"></asp:Label></td> <td colspan="2"> <asp:TextBox ID="txtProjectNumber" runat="server"></asp:TextBox></td> <td> <asp:Button ID="btnShow" runat="server" Text="Show Report" OnClick="btnShow_Click" /></td> </tr> </table> <asp:Label ID="lblError" runat="server" ForeColor="Red" Width="576px"></asp:Label><br /> <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="False" EmptyDataText="There were no results to your query."> <Columns> <asp:BoundField DataField="MainProject" HeaderText="Project" /> <asp:BoundField DataField="BillTask" HeaderText="Task" /> <asp:BoundField DataField="invoice" HeaderText="Invoice No" /> <asp:BoundField DataField="InvoiceDate" DataFormatString="{0:d}" HeaderText="Invoice Dt" HtmlEncode="False" /> <asp:BoundField DataField="Description" HeaderText="Description" HtmlEncode="False" /> <asp:BoundField DataField="footer" HeaderText="Footer" HtmlEncode="False" /> </Columns> <RowStyle BackColor="#E0E0E0" /> <HeaderStyle BackColor="Silver" /> </asp:GridView> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> <script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler); Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler) function BeginRequestHandler(sender, args) { var btn = document.getElementById("<%= btnShow.ClientID %>"); btn.disabled = true; var txt1 = document.getElementById("<% = txtInvoiceDateFrom.ClientID %>"); txt1.disabled = true; txt1 = document.getElementById("<% = txtInvoiceDateTo.ClientID %>"); txt1.disabled = true; txt1 = document.getElementById("<% = txtProjectNumber.ClientID %>"); txt1.disabled = true; return false; } function EndRequestHandler(sender, args) { var btn = document.getElementById("<%= btnShow.ClientID %>"); btn.disabled = false; var txt1 = document.getElementById("<% = txtInvoiceDateFrom.ClientID %>"); txt1.disabled = false; txt1 = document.getElementById("<% = txtInvoiceDateTo.ClientID %>"); txt1.disabled = false; txt1 = document.getElementById("<% = txtProjectNumber.ClientID %>"); txt1.disabled = false; return false; } </script> </html>vb Code:
Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load End Sub Private Sub BindGrid() Dim cmd As New XSQL("XXXXX", 2) Try cmd.AddStrParam("@Project", txtProjectNumber.Text, 20) cmd.AddStrParam("@StDate", txtInvoiceDateFrom.Text, 10) cmd.AddStrParam("@EndDate", txtInvoiceDateTo.Text, 10) gvResults.DataSource = cmd.ExecuteDS("USP_GetCreditMemos") gvResults.DataBind() lblError.Text = "" Catch ex As Exception lblError.Text = ex.Message End Try End Sub Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) If txtProjectNumber.Text = "" Then If txtInvoiceDateFrom.Text <> "" And txtInvoiceDateTo.Text <> "" Then BindGrid() Else Show("You must enter a Project Number if you are not using a date range.") End If Else BindGrid() End If End Sub Private Sub Show(ByVal message As String) Dim strScript As String strScript = "<script type='text/javascript' language='javascript'>" strScript = strScript & "alert('" & message & "');" strScript = strScript & "</script>" ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), "alert", strScript, False) End Sub End Class




Reply With Quote