Showing posts with label cdd. Show all posts
Showing posts with label cdd. Show all posts

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"/>

Saturday, March 24, 2012

CascadingDropDown within an Accordion

I have a functioning CDD that I add dynamically to the page during ON_LOAD. I also have a new Accordion that I declare in the ASCX file. Both of these work fine until I try to put the CDD inside the Accordion. I get the following error:

Couldn't get extender properties on extender . Make sure the ID is spelled correctly and the control is on the page.

With the CDD inside the Accordion, I find the dropdown id using:

tempControl = MyAccordion.FindControl("ddlClientCompany")

item1.TargetControlID = tempControl.UniqueID

When I step thru the code with VS I can see that the control is found and an ID is passed in. But an error is thrown:o my question is: 1) is this a bug? 2) What is the correct procedure to include a CDD within the Accordion?

Here is my full code for when I add the CDD (this works fine outside of the Accordion)...

Dim tempExtenderAs AtlasControlToolkit.CascadingDropDown =New AtlasControlToolkit.CascadingDropDown()

Dim item1As AtlasControlToolkit.CascadingDropDownProperties =New AtlasControlToolkit.CascadingDropDownProperties()

item1.Category ="clientCompanyID"

If item1.Category =""Then item1.Category ="none"

item1.DefaultCompany = bu.default_company_id

item1.PromptText ="-- Select Company --"

item1.ServiceMethod ="GetClientCompanies"

item1.ServicePath ="~/buService.asmx"

Dim tempControlAs DropDownList

tempControl = MyAccordion.FindControl("ddlClientCompany")

item1.TargetControlID = tempControl.UniqueID

tempExtender.TargetProperties.Add(item1)

I'll defer to Ted as Accordion expert, but I'm thinking you don't want UniqueID in "item1.TargetControlID = tempControl.UniqueID". I'd try just ID instead.

Thanks for your reply David,

First let me say that I think Atlas rocks and and glad to be part of the CTP, pain and all. Secondly, I am very excited about how Atlas has effect my application interface design- cool ideas with low overhead to implement...nice job!

I did try some combinations that included the ID instead of the UniqueID...but they didnt work.

Although I never got it to work by adding the Extender dynamically, I was able to get it to work when I fully declared the CDD within the ASCX page. This is a work around in my mind and would be very interested in finding out how to do this properly dynamically.

I am also unable to get the SELECTED_VALUE of the CDD from within the Accordion. I am forced to just parse the query object like so.

' lets try to checkout the form values manually

Dim tempDDLClientCompanyAs DropDownList = MyAccordion.FindControl("ddlClientCompany")

Dim tempDDLClientNameAs DropDownList = MyAccordion.FindControl("ddlClientName")

' This is still not returning a value

'client_name = sec.ScrubData(tempDDLClientCompany.SelectedValue)

'manager_name = sec.ScrubData(tempDDLClientName.SelectedValue)

Dim tempClientCompanyID = tempDDLClientCompany.UniqueID

Dim tempClientNameID = tempDDLClientName.UniqueID

Try

Dim formsCountAsInteger = (Request.Form.Count) - 1

If formsCount <= 0ThenExitTry

Dim countAsInteger = 0

' 1) Grab the values from the request for company and client name

Dim tempField, tempValueAsString

' This is not zero based because the forms collection is not zero based.

For count = 1To formsCount

tempValue =CType(Request.Form.Item(count),String)

tempField =CType(Request.Form.GetKey(count),String)

If tempField = tempClientCompanyIDThen

client_name = tempValue

EndIf

If tempField = tempClientNameIDThen

manager_name = tempValue

EndIf

Next

Catch exAs Exception

EndTry


Hi Matthew,

Are you adding the extender right next to the drop down? If they're in different naming containers than that might explain why it can't find it (i.e. even though you pass in UniqueID, it still wouldn't be able to find a match if it was only looking in its own naming container).

Thanks,
Ted


Thanks for the reply Ted,

Let me try to recall that issue...it was a day or so ago and I have since gotten my head around other items, but I believe I tried several places for the extender. 1) Outside the Accordion, and 2) inside the Accordion within the same pane as the CDD if that is what you mean. I'll pull the code tomorrow and see where I left off. cheers,

Wednesday, March 21, 2012

cascadingdropdown many child share one parent, child of child

I have 6 cdd structured as follows

cdd 1 (top most)

cdd 2 -> parent = 1

cdd 3 -> parent = 2

cdd 4 -> parent = 2

cdd 5 -> parent = 2

cdd 6 -> parent = 5

As you can see 3, 4 & 5 share the same parent. This works fine and all drop down populate = great ! When I add 6, where the parent is one of the children that share a parent, IE does not respond. If I click on the page I get (Not Responding) in the title bar and if I keep clicking I get the popup "The script is causing internet explorer to run slowly do you want to abort the script".

Code is here...

<ajaxToolKit:CascadingDropDownID="cddState"runat="server"TargetControlID="ddState"

Category="State"LoadingText="[Loading states...]"PromptText="-Please Select-"

ServiceMethod="GetTechnicalComboValues"ServicePath="Services\CascadeCombo.asmx"

Enabled="True">

</ajaxToolKit:CascadingDropDown>

<ajaxToolKit:CascadingDropDownID="cddSuburb"runat="server"TargetControlID="ddSuburb"

Category="Suburb"LoadingText="[Loading suburbs...]"PromptText="-Please Select-"

ServiceMethod="GetTechnicalComboValues"ServicePath="Services\CascadeCombo.asmx"

Enabled="True"ParentControlID="ddState">

</ajaxToolKit:CascadingDropDown>

<ajaxToolKit:CascadingDropDownID="cddHomeDrive"runat="server"TargetControlID="ddHomeDrive"

Category="HomeDrive"LoadingText="[Loading drives...]"PromptText="-Please Select-"

ServiceMethod="GetTechnicalComboValues"ServicePath="Services\CascadeCombo.asmx"

Enabled="True"ParentControlID="ddSuburb">

</ajaxToolKit:CascadingDropDown>

<ajaxToolKit:CascadingDropDownID="cddProfilePath"runat="server"TargetControlID="ddprofilepath"

Category="ProfilePath"LoadingText="[Loading paths...]"PromptText="-Please Select-"

ServiceMethod="GetTechnicalComboValues"ServicePath="Services\CascadeCombo.asmx"

Enabled="True"ParentControlID="ddSuburb">

</ajaxToolKit:CascadingDropDown>

<ajaxToolKit:CascadingDropDownID="cddExchangeServer"runat="server"TargetControlID="ddExchangeServer"

Category="ExchangeServer"LoadingText="[Loading servers...]"PromptText="-Please Select-"

ServiceMethod="GetTechnicalComboValues"ServicePath="Services\CascadeCombo.asmx"

Enabled="True"ParentControlID="ddSuburb">

</ajaxToolKit:CascadingDropDown>

<ajaxToolKit:CascadingDropDownID="cddMailStorageGroup"runat="server"TargetControlID="ddMailStorageGroup"

Category="MailStore"LoadingText="[Loading stores...]"PromptText="-Please Select-"

ServiceMethod="GetTechnicalComboValues"ServicePath="Services\CascadeCombo.asmx"

Enabled="True"ParentControlID="ddExchangeServer">

</ajaxToolKit:CascadingDropDown>

Thanks

Was this ever resolved? I'm having a very similar problem.

Here's my scenario:

cdd1 (top-most)

cdd2 -> parent = 1

cdd3 -> parent = 1

cdd4 -> parent = 1

cdd5 -> parent = 4

Now I get the same problem as you: IE6 unresponsive and later the message "A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?".

Note that I don't have this issue if I remove cdd5 (leaving 1, 2, 3, 4) or if I remove cdd2 (leaving 1, 3, 4, 5) or if I remove cdd3 (leaving 1, 2, 4, 5). So it appears that what's common with your scenario is that if you have three CascadingDropDowns dependent on a given CDD and another CDD dependent on one of the three level2 CDDs, the web page hangs with the above errors.

Thanks for any insight you can give.

-Wayne


Yes I resoved this (by workaround), I apologise for not updating my post.

It comes down to the order the cascading controls appear in the markup (note: not the combo boxes BUT the cascading extenders themselves).

What you need to is to position cdd4 above cdd3 so you end up with this:

cdd1 (top-most)

cdd2 -> parent = 1

cdd4 -> parent = 1

cdd3 -> parent = 1

cdd5 -> parent = 4

As I indicated above the change is only how they appear in the markup. Your cascading relationships and combo boxes themselves dont change. I hope this makes sense.

This sent me crazy... with no replies to my original post it was only by fluke that I discovered this behaviour.

I hope you have success.


Wow! It works.

Thanks very much for the help!

Did you experience any other gotchas using the CascadingDropDownExtender? Initially, I was planning on using standard asp DropDownLists with Ajax UpdatePanels, instead of the CascadingDropDownExtender. However, this is not possible in a FormView if you name your controls the same in both InsertItemTemplate and UpdateItemTemplate. (Here's a post on this problem: http://forums.asp.net/p/1058745/1570069.aspx) I had decided that if I couldn't get the CascadingDropDownExtender to work, I'd just use the UpdatePanels in the template most used for this app. If you know of any other issues with this extender, I'd appreciate finding out. Seems like your scenario might be somewhat similar to mine. I assume you're doing inserts and updates with the dropdowns on which you had the problem?

Thanks again for the help!


The only other problem I had was populating a cascading set via Javascript. There are a number of articles on this but I couldn't get it to work.

The scenario I had was select a State and then select a suburb. The suburb would populate based on the state selected = standard stuff.

I had a copy function that copied these values from another record and I wanted to use Javascript to avoid a postback. I could set the state value but I couldn't set the suburb value.

CascadingDropDown items limited (Error) ??

Hello people,

I have a big problem with CDD, try to load a large amount of items, for example.

In the sample of CDD change the webservice "CarsService" method "GetDropDownContents",
insert this code:

for (int i = 0; i < 870; i++)
{
values.Add(new CascadingDropDownNameValue(string.Format("Name{0}",i), string.Format("Value{0}",i)));
}

and the Method Erro 500 show ...

my list are 890 items

Please Help...!Idea

What is the exact error you are getting? Is it possible to figure out at what exact number of items cdd starts to error out?

Also, what is the scenario in which you need to have so many items in a cdd? From a usability point of view it does not seem very appropriate.


Try:http://ajax.asp.net/docs/mref/P_System_Web_Script_Serialization_JavaScriptSerializer_MaxJsonLength.aspx

Thank you so much for your response...

Solve my problem perfect...Yes

Big Smile