Finding a control within RadPageView with JavaScript

2 posts, 0 answers
  1. Lee
    Lee avatar
    3 posts
    Member since:
    May 2014

    Posted 14 Apr 2015 Link to this post

    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.

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    829 posts

    Posted 17 Apr 2015 Link to this post

    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.

     
Back to Top