Showing posts with label timeout. Show all posts
Showing posts with label timeout. Show all posts

Wednesday, March 28, 2012

Change the default async timeout error message

I can't believe this question hasn't been asked before... How do I change the message that is displayed to the user when an async postback has timed out? I've searched the scriptmanager documentation and tried to handle the asyncpostbackerror or whatever event (which doesn't fire on a timeout), but I can't figure out how to do it. Any hints will be appreciated. Thanks.Hi,

You can add your own error handler as the following code:
function StartAsyncPostBack() {
WebService.set_timeout(2000);
WebService.RunForLongTime(0, Complete, OnError); // call a method with the signature of?RunForLongTime(int);
}
function OnError(result) {// your error handler
alert("error: " + result.get_message());
}

Hope this helps.

Monday, March 26, 2012

CDD Timeout

I had this problem going in another thread, but it was getting to convoluted between this and the other problems I had. Since I now have all of my other problems solved I thought I'd start a new thread for the remaining one.

Currently I have a CDD control that, whenever I try to attach a ParentControlID to it, results in a script timeout error in IE. The cute thing is that the control will work fine if I keep the ParentControlID property out of the tag.

Here are the controls I currently have on my page. All of them work except for cddActivity9 which is my problem child.
<cc1:CascadingDropDownID="cddActivity1"runat="server"TargetControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetBusinessUnits"LoadingText="Loading values..."ServicePath="~/services/RefTables.asmx"Category="BU"/>
<cc1:CascadingDropDownID="cddActivity2"runat="server"TargetControlID="ACTIVITY_STATUS"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetActivityStatusForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="ACTIVITY_STATUS"/>
<cc1:CascadingDropDownID="cddActivity3"runat="server"TargetControlID="PERFORMANCE_UNIT"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetPerformanceUnitsForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="PERFORMANCE_UNIT"/>
<cc1:CascadingDropDownID="cddActivity4"runat="server"TargetControlID="ENGR_PKG_REQ"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetEngLocationsForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="ENGR_PKG_REQ"/>
<cc1:CascadingDropDownID="cddActivity5"runat="server"TargetControlID="EXPENSE_TYPE"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetExpenseTypesForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="EXPENSE_TYPE"/>
<cc1:CascadingDropDownID="cddActivity6"runat="server"TargetControlID="GFO"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetGFOForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="GFO"/>
<cc1:CascadingDropDownID="cddActivity7"runat="server"TargetControlID="WORK_LOCATION"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetWorkLocationsForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="WORK_LOCATION"/>
<cc1:CascadingDropDownID="cddActivity8"runat="server"TargetControlID="RESPONSIBLE_GROUP"ParentControlID="PERFORMANCE_UNIT"PromptText=" "ServiceMethod="GetResponsibleGroupsForPU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="RESPONSIBLE_GROUP"/>
<cc1:CascadingDropDownID="cddActivity9"runat="server"TargetControlID="SUB_EXPENSE_TYPE"ParentControlID="EXPENSE_TYPE"PromptText=" "ServiceMethod="GetSubExpenseTypesForExpenseTypes"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="SUB_EXPENSE_TYPE"/>
<cc1:CascadingDropDownID="cddActivity10"runat="server"TargetControlID="SUB_RESPONSIBLE_GROUP"ParentControlID="RESPONSIBLE_GROUP"PromptText=" "ServiceMethod="GetSubResponsibleGroupsForResponsibleGroups"LoadingText="Loading values..."ServicePath="~/services/RefTables.asmx"Category="SUB_RESPONSIBLE_GROUP"/>
<cc1:CascadingDropDownID="cddActivity11"runat="server"TargetControlID="PLANNING_CATEGORY"ParentControlID="SUB_EXPENSE_TYPE"PromptText=" "ServiceMethod="GetPlanningCategoriesForSubExpenseTypes"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="PLANNING_CATEGORY"/
The ServiceMethod being called by the problem child looks as such:
[WebMethod]
publicCascadingDropDownNameValue[] GetSubExpenseTypesForExpenseTypes(string knownCategoryValues,string category)
{StringDictionary kv =CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
if(!kv.ContainsKey("EXPENSE_TYPE"))returnnewList<CascadingDropDownNameValue>().ToArray();

return GatherList(kv["EXPENSE_TYPE"],newREF_SUB_EXPENSE_TYPETableAdapter()).ToArray();
}

And I know it works, because it's identical to a similar method being called by cddActivity2 which does work.
[WebMethod]
publicCascadingDropDownNameValue[] GetActivityStatusForBU(string knownCategoryValues,string category)
{StringDictionary kv =CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
if (!kv.ContainsKey("BU"))returnnewList<CascadingDropDownNameValue>().ToArray();

return GatherList(kv["BU"],newREF_ACTIVITY_STATUSTableAdapter()).ToArray();
}

Like I said, the control will work without a ParentControlID; I just need to workwith one is all. I've tried creating a new control, renaming the parent and child DropDownLists, using parent and child information from controls that worked and nothing has made a difference. I'm only looking at pulling max 7 records for this control so it's nothing too big. I've tried running both Fiddler and nikhilk's tool to no success.

Any ideas, shots in the dark, or pointing out where I missed/did something stupid would be appreciated.

Thanks,
Sean

Ok, strange as it is, a coworker found an answer to this problem and all it required was reordering the cascade controls. What he did was list all of the child-grandchild-etc... controls first and then the parent control last. It doesn't seem like this would matter for squat, but it works.

Here is the correct order we are using now.

<cc1:CascadingDropDownID="cddActivity5"runat="server"TargetControlID="EXPENSE_TYPE"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetExpenseTypesForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="EXPENSE_TYPE"/>
<cc1:CascadingDropDownID="cddActivity9"runat="server"TargetControlID="SUB_EXPENSE_TYPE"ParentControlID="EXPENSE_TYPE"PromptText=" "ServiceMethod="GetSubExpenseTypesForExpenseTypes"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="SUB_EXPENSE_TYPE"/>
<cc1:CascadingDropDownID="cddActivity11"runat="server"TargetControlID="PLANNING_CATEGORY"ParentControlID="SUB_EXPENSE_TYPE"PromptText=" "ServiceMethod="GetPlanningCategoriesForSubExpenseTypes"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="PLANNING_CATEGORY"/>
<cc1:CascadingDropDownID="cddActivity3"runat="server"TargetControlID="PERFORMANCE_UNIT"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetPerformanceUnitsForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="PERFORMANCE_UNIT"/>
<cc1:CascadingDropDownID="cddActivity8"runat="server"TargetControlID="RESPONSIBLE_GROUP"ParentControlID="PERFORMANCE_UNIT"PromptText=" "ServiceMethod="GetResponsibleGroupsForPU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="RESPONSIBLE_GROUP"/>
<cc1:CascadingDropDownID="cddActivity10"runat="server"TargetControlID="SUB_RESPONSIBLE_GROUP"ParentControlID="RESPONSIBLE_GROUP"PromptText=" "ServiceMethod="GetSubResponsibleGroupsForResponsibleGroups"LoadingText="Loading values..."ServicePath="~/services/RefTables.asmx"Category="SUB_RESPONSIBLE_GROUP"/>
<cc1:CascadingDropDownID="cddActivity2"runat="server"TargetControlID="ACTIVITY_STATUS"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetActivityStatusForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="ACTIVITY_STATUS"/>
<cc1:CascadingDropDownID="cddActivity4"runat="server"TargetControlID="ENGR_PKG_REQ"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetEngLocationsForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="ENGR_PKG_REQ"/>
<cc1:CascadingDropDownID="cddActivity6"runat="server"TargetControlID="GFO"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetGFOForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="GFO"/>
<cc1:CascadingDropDownID="cddActivity7"runat="server"TargetControlID="WORK_LOCATION"ParentControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetWorkLocationsForBU"LoadingText="<%$ Resources:Resource, CCDDLoadingText %>"ServicePath="~/services/RefTables.asmx"Category="WORK_LOCATION"/>
<cc1:CascadingDropDownID="cddActivity1"runat="server"TargetControlID="BUSINESS_UNIT"PromptText=" "ServiceMethod="GetBusinessUnits"LoadingText="Loading values..."ServicePath="~/services/RefTables.asmx"Category="BU"/>