Background: I have a Silverlight Control in a sharepoint webpart that exposes some scriptable methods. I use those methods to call a webservice and get an array of menu options. These menu options are then injected into Sharepoint ECB menu which appears on clicking an item in a list.
The problem I am having is being able to get the clientID of the silverlight control in Javascript so then I can use it to call the scriptable method. The page this will be on may have multiple instances of the same silverlight control as well as the controls hierarchy might be different....
Here's the client side JS code I currently have in which the clientID is hardcoded...
function TestQueryMenu() {
var plugin = document.getElementById('ctl02_IntuitionModelBrowserControl');
var contextUri = document.getElementById('TestUri').value;
var key = contextUri;
plugin.Content.ModelBrowser.GetContextMenuOptionsCompleted = MenuItemsReceived;
plugin.Content.ModelBrowser.GetContextMenuOptionsAsync(key, contextUri);
}