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

RadMultiPage client object problem

4 Answers 186 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
szumm
Top achievements
Rank 1
szumm asked on 01 Feb 2011, 12:25 AM

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?

4 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 01 Feb 2011, 10:16 AM
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.
0
szumm
Top achievements
Rank 1
answered on 01 Feb 2011, 10:50 AM

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

0
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
answered on 31 May 2018, 02:58 PM

Its only been a little over 8 years, however the documentation error szumm found has not been fixed yet. I just wasted an our trying to figure out why findPageViewByID wasn't working.

 

Please fix your documentation.

0
Peter Milchev
Telerik team
answered on 01 Jun 2018, 08:10 AM
Hello Albert,

Actually, the example that Rafal reported as incorrect is indeed correct, it just assumes that the ClientID of the PageView will be PageView2. The most accurate example would be if the id is passed as an evaluated expression of the server code that is used to obtain the MultiPage. 

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

I have updated the example in the documentation and soon it should be live - https://github.com/telerik/ajax-docs/commit/f6111e739588f266ed6f5d69e196f047301e3f90.

Generally, we encourage the people to contribute to our online resources such as the forums, code library projects, and even documentation. We reward such efforts that are beneficial for the community with Telerik points.

For example, when you encounter a typo or a simple issue in an example, you can click the Edit this page button on the top left corner. 



This would redirect you to the Markdown version of the page in our GitHub repository for the documentation where you can fix the issue. Once you have fixed the example or the typo, you can create a pull request which we will review. If the fix is correct, we will merge it and then it should be included in the next upload of the documentation.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
TabStrip
Asked by
szumm
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
szumm
Top achievements
Rank 1
Albert Shenker
Top achievements
Rank 1
Veteran
Iron
Peter Milchev
Telerik team
Share this question
or