I am using NetAdvantage 2010.1 and have tried to implement lazy loading for a WebDropDown control used on a SharePoint page as described in the documentation (developer's guide).
To fire the event ItemsRequested on server side, the documentation is showing the following JavaScript code example:
// The client event 'DropDownOpening' takes two parameters sender and e// sender is the object which is raising the event// e is the DropDownContainerEventArgsfunction WebDropDown_DropDownOpening(sender, e) { //Gets reference to the WebDropDown control var wdd = $find("WebDropDown1"); wdd.loadItems();}
// sender is the object which is raising the event
// e is the DropDownContainerEventArgs
//Gets reference to the WebDropDown control
"WebDropDown1"
In SharePoint calling $find("WebDropDown1") will always return null. So I have tried to replace the code line with
var wdd = $find('<%= WebDropDown1.ClientID %>');
As soon as I click the dropdown button I get the error:
"Error: Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.Parameter name: data"
Next I tried to do get a reference to the control replacing the call of the $find method with this:
var wdd = document.getElementById(''<%= WebDropDown1.ClientID %>');
Now I have wdd set when clicking the dropdownbutton. But the subsequent call of
wdd.loadItems();
leads to the error:
"Error: Object doesn't support this property or method"
What can I do to fire the event ItemsRequested when using the control with SharePoint?
Snoopy,
Let me know if you have any questions with this matter.
Thanks.
This line gets a reference to the DOM element, not the javascript object:
The correct API to use is $find (), or to get it from the ig_controls array, if the first doesn't work.
About the error "Cannot deserialize" - i cannot answer this for sure, i suggest to contact Development Support which will try to reproduce this behavior on the specific environment.
Thank you,
Angel