Showing posts with label seconds. Show all posts
Showing posts with label seconds. Show all posts

Monday, March 26, 2012

Catch a Sys.WebForms.PageRequestManagerServerErrorException that occurs when server is dow

Hello,

I have an ajax timer control that updates an update panel every couple of seconds. When/if the server is down, there is an error message in a popup that says

"Sys.WebForms.PageRequestManagerServerErrorException: An unknown error ocurred while processing the request
on the server. The status code reutrned from the server was: 12029"

Basically I want to be able to catch this exception so that the popup does not continue to occur.

Is this possible?

Thanks in advance.

Take a look at the following posts on my blog:

http://fredrik.nsquared2.com/viewpost.aspx?PostID=395&showfeedback=true

http://fredrik.nsquared2.com/viewpost.aspx?PostID=394&showfeedback=true

You can also use the PageRequestManager, for example (This code should be located on the client):

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
if (args.get_error() != undefined)
{
var errorMessage;
if (args.get_response().get_statusCode() == '200')
{
errorMessage = args.get_error().message;
}
else
{
errorMessage = 'An unspecified error occurred. ';
}
args.set_errorHandled(true);
alert(errorMessage);
}
}


That's just what I needed. Thank you.

Saturday, March 24, 2012

CascadingDropDown slow to load in IE7?

I have a cascading dropdown that loads about 13,000 items from a PageMethod. In Firefox 2 this takes just under 5 seconds, but the same page in IE7 is taking about 160 seconds to load the same dropdown! IE response to using that page is also slow once it has loaded.

If I populate the dropdown server-side by binding a datasource directly to the control is takes a while to render the page but nowhere near 2.5 minutes.

Code example:

HTML:

<asp:dropdownlist id="ddlAlert" runat="server" width="100%"></asp:dropdownlist>
<ajt:CascadingDropDown ID="cddAlerts" runat="server" TargetControlID="ddlAlert" Category="Alert" ServiceMethod="GetAlerts" LoadingText="Loading alerts..." />
Code Behind:
 <System.Web.Services.WebMethod()> _
<System.Web.Script.Services.ScriptMethod()> _
Public Shared Function GetAlerts(ByVal knownCategoryValuesAs String,ByVal categoryAs String)As CascadingDropDownNameValue()
Dim retValAs New Collections.Generic.List(Of CascadingDropDownNameValue)
retVal.Add(New CascadingDropDownNameValue("All Alerts","0",True))
Dim appAs New MOAE.MOAE
Dim dsAs DataSet = app.GetAlertProfiles
Try
For Each rowAs DataRowIn ds.Tables(0).Rows
retVal.Add(New CascadingDropDownNameValue(row("AlertDisplayName").ToString, row("AlertProfileID").ToString))
Next
Catch exAs Exception
app.LogWarning(ex, Diagnostics.EventLogEntryType.Error)
End Try ds =Nothing app =Nothing
Return retVal.ToArray
End Function

Does anyone have any way of speeding this up? Is this just down to IE's Javascript engine?

Cheers,
Nick

I know this isn't the answer you want to hear, but as a user I would cringe at a dropdown containing 13k items. How would I ever find the item I'm looking for. Isn't there a better design implementation?

I don't know but I could certainly see IE having a heart attack with a 13k dropdown and that would account for the slow page. Might not be completely fixable if that's the case...


It's the conclusion I had come to as well but I was curious at the disparity in speed between Firefox's and IE's implementation of this....


Hi Nickfoster,

IE7 and Firefox are have their own merits. Some tests show that Firefox do better job on string processing. But I am quite agree with Noahb, we should limit its items in your case.

Best regards,

Jonathan