Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
WebDropDown and SharePoint
posted

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 DropDownContainerEventArgs
function WebDropDown_DropDownOpening(sender, e) {

   //Gets reference to the WebDropDown control
     var wdd = $find("WebDropDown1");

     wdd.loadItems();
}

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?

  • 12679
    posted

    Snoopy,

    Let me know if you have any questions with this matter.

    Thanks.

  • 24671
    Suggested Answer
    posted

    This line gets a reference to the DOM element, not the javascript object:

    var wdd = document.getElementById(''<%= WebDropDown1.ClientID %>');

    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