Edit RadPageView css on client side using javascript

3 posts, 1 answers
  1. Vitalii
    Vitalii avatar
    9 posts
    Member since:
    Jan 2013

    Posted 10 Jan 2013 Link to this post

    I have multi page with page vies:

     <telerik:RadMultiPage runat="server" ID="multipage" SelectedIndex="0">
        <telerik:RadPageView runat="server" ID="PageViewQS" CssClass="tab"> </telerik:RadPageView>
        <telerik:RadPageView runat="server" ID="PageViewCS" CssClass="tab"> </telerik:RadPageView>
     </telerik:RadMultiPage>

    Css class:
    .tab {
        padding: 10px;
        overflow: auto;
        height: 650px;
    }

    I want to change css height on client side using javascript. I tried this:
                   $(document).ready(function () {
                        if (screen.height > 800) {
                            $('#multipage').css('height', '475px');
                            $('#PageViewQS').css('height', '475px');
                        }
                    });

    but id does not work.

    Any ideas how can I do it?
  2. Answer
    Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 15 Jan 2013 Link to this post

    Hello Vitali,

    I can suggest you to access the DOM element of the RadPageView and set the height in the following manner :
    <script type="text/javascript">
               function pageLoad() {
     
                  var $ = $telerik.$;
                  var height = $(window).height();
                  if (height > 800) {
     
                      var MultiPage = $find('<%= multipage.ClientID %>');
                      for (i = 0; i < MultiPage.get_pageViews().get_count() ; i++) {
                          var PageView = MultiPage.get_pageViews().getPageView(i);
                          PageView.get_element().style.height = "475px";
                      }
                  }
              }
     
          </script>


    Kind regards,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vitalii
    Vitalii avatar
    9 posts
    Member since:
    Jan 2013

    Posted 25 Jan 2013 Link to this post

    Thank you for your answer, I will try)
Back to Top