This is a migrated thread and some comments may be shown as answers.

Finding a control within RadPageView with JavaScript

1 Answer 121 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Lee
Top achievements
Rank 1
Lee asked on 14 Apr 2015, 12:51 PM

I have the following general structure building my page:

In master page:

<telerik:RadMultiPage RenderSelectedPageOnly="True" ID="MainMultiPage" runat="server" >
     <telerik:RadPageView ID="RadPageView0" runat="server" Width="100%" Height="100%">
        <asp:ContentPlaceHolder ID="RadPageViewContent0" runat="server" />
     </telerik:RadPageView>

     ..........//multiple pageviews

</telerik:RadMultiPage>

 

In the page:

<asp:Content ContentPlaceHolderID="RadPageViewContent0" runat="server">

    <aps:MySearchControl Visible="True" ID="MySearch" runat="server" selectiononfocus="SelectAll" /> 

    .....//other controls and elements

</asp:Content>

 

Javascript to reference the custom control 'MySearchControl':

on Master - 

function GetMultiPage() {
     return $find("<%= MainMultiPage.ClientID%>");
}
function GetPageView0() {
     var multiPage = GetMultiPage();
     return multiPage.get_pageViews().getPageView(0);

}

function MyJSSearch() {
     var pageView = GetPageView0();
     var domElem = pageView.get_element(); //--successful execution stops here, cant get a reference to my custom control MySearch
     return $telerik.$(domElem).find(<%=MySearch.ClientID%>);
}

 

This is not working.  I need to get a reference to MySearch control, but am stuck.  Please advise on possible solutions.  Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 17 Apr 2015, 06:17 AM
Hello,

Instead of using the find() method you should use the getElementById() method to get the control. The RadPageView does not have a method to access the controls you place in it.
var control = document.getElementById("MySearch");

Regards,
Ivan Danchev
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
General Discussions
Asked by
Lee
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Share this question
or