Torben L.
Torben L.

Reputation: 73

How to get an Element inside a RadPageView inside a RadMultiPage?

I have html-code like this:

<telerik:RadMultiPage ID="MultiPage" runat="server">   
   <telerik:RadPageView ID="TablePage" runat="server">  
      <Cx:DataObjectDefinitionTree ID="TableOverview"   runat="server"/>  
   </telerik:RadPageView>  
</telerik:RadMultiPage>  

I can get the Multipage by this: var multiPage = $find('<%= MultiPage.ClientID %>');
But i am not able to get either the PageView or the DataObjectDefinitionTree.
Though i need the DataObjectDefinitionTree.
I tried to get the PageView from the MultiPage and then the DataObjectDefinitionTree from that but that did not work either.

How can i get the DataObjectDefinitionTree into an Variable in Javascript?

Edit: I just want to call two methods from DataObjectDefinitionTree (it is basicly the same as a RadTreeView).
These methods are _getAllItems() and get_selectedNode().

Upvotes: 0

Views: 2413

Answers (3)

Torben L.
Torben L.

Reputation: 73

Ok, i found the Error:
<%=TableOverview.ClientID %> gives the wrong ID. To get the correct ID i had to add the following to my ASPX-Control DataObjectDefinitionTree:
public override string ClientID {
get { return TableTree.ClientID; }
//TableTree is the base object of DataObjectDefinitionTree
}

Now i get the correct ID when i call <%=TableOverview.ClientID %>.
Thanks for your help, though. :)

Upvotes: 0

Francis P
Francis P

Reputation: 13655

Ok then, the main problem here is How to access your WebUserControl's javascript from the parent page. You'll need to wrap your DataObjectDefinitionTree's content in a div using the same ID as your UserControl. Here is a link explaining this.

Then from the UserControl, declare your own functions accessing RadTreeView's Client-Side API (_getAllItems() and get_selectedNode()).

Upvotes: 0

Francis P
Francis P

Reputation: 13655

Telerik's Client-Side API is pretty complete, see by yourself:

var multiPage = $find('<%= MultiPage.ClientID %>');
var pageView = multiPage.findPageViewByID("TablePage");

As for the DataObjectDefinitionTree, you should be able to get the DOM element for the pageView:

var domElement = pageView.get_element();
dataObjDefTree = domElement.getElementById('<%=TableOverview.ClientID %>');

Or you can try something like this:

var dataObjDefTree = document.getElementById('<%=TableOverview.ClientID %>');

Upvotes: 1

Related Questions