RadMultiPage client object problem

3 posts, 1 answers
  1. szumm
    szumm avatar
    13 posts
    Member since:
    May 2010

    Posted 31 Jan 2011 Link to this post

    Hi,

    I have a aspx content page which is using a master page. In my content page I have two RadMultiPage controls and a RadTabStrip control. One RadMultiPage is assigned to RadTabStrip through the MultiPageID property. The second RadMultiPage has by default set the SelectedIndex to 1. What i try to do, is to change the second RadMultiPage selected index on RadTabStrip OnClientTabSelected event. Looking at the samples and the documentation i came up with something like that:

    function clientTabSelected(sender, args) {
                var multipage = document.getElementById('<%= ribbonMultiPage.ClientID %>');
                var v = multipage.findPageViewByID("accountsView");
                if (v)
                    alert('got it');
                else
                    alert('null.');
            }

    where ribbonMultiPage is the id of the second RadMultiPage. When i run the code i got the exception "Object doesn't support this property or method" on line var v = multipage.findPageViewByID("accountsView");. Could you point me a solution to that?

  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Feb 2011 Link to this post

    Hello,

    Since you are using Ajax Control, You need to use $find instead of document.getElementByID. I have modified the code like below.

    javascript:
    function clientTabSelected(sender, args)
       {
             var multipage = $find("<%=ribbonMultiPage.ClientID %>");
              var v = multipage.findPageViewByID("accountsView");
              if (v)
                  alert('got it');
              else
                  alert('null.');
       }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. szumm
    szumm avatar
    13 posts
    Member since:
    May 2010

    Posted 01 Feb 2011 Link to this post

    You are totally right, thank you so much for pointing that out :) i created a proof of concept for this and everything works like a charm now;] Also, i've found a bug in the documentation of RadMultiPage Client-Side Object - the sample of using findPageViewByID looks like this:

    var multiPage = $find("<%=RadMultiPage1.ClientID %>");
    var pageView = multiPage.findPageViewByID("Pageview2");
    if(pageView)
       pageView.set_selected(true);

    Please notice the correct version of param for findPageViewByID should be the client-side ID so it should look as below:

    var multiPage = $find("<%=RadMultiPage1.ClientID %>");
    var pageView = multiPage.findPageViewByID("Pageview2.ClientID");
    if(pageView)
       pageView.set_selected(true);
     

    Regards,

    Rafal

Back to Top