Resizing RadPageView inside RadMultiPage

5 posts, 0 answers
  1. Rodrigo
    Rodrigo avatar
    6 posts
    Member since:
    Oct 2015

    Posted 07 Oct 2015 Link to this post

    I have a RadMultiPage with multiple RadPageView, some of which are created dynamically. The page starts with one RadPageView and the user can add more via a button. The initial code is something like the one bellow.

    <telerik:RadMultiPage ID="ContactsPagesViews" ScrollBars="Auto" Height="100%"
            RenderMode="Lightweight" runat="server"
            OnPageViewCreated="ContactsPagesViews_PageViewCreated"
            SelectedIndex="0">
            <telerik:RadPageView ID="RadPageView1" runat="server" Height="600px">
                more elements here
        </telerik:RadPageView>
    </telerik:RadMultiPage>

    I also have some code to resize my RadPageViews to fit the size of my window. For this I use the following code:

    01.<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    02.    <script type="text/javascript">
    03.            $(document).ready(function () {
    04.                 
    05.                $(window).resize(function () {
    06.                    ResizePage($find('<%= ContactsPagesViews.ClientID %>'))
    07.                });
    08. 
    09.                 ResizePage($find('<%= ContactsPagesViews.ClientID %>'))
    10.            });
    11. 
    12.        function ResizePage(multiPage) {
    13.            for (i = 0; i < multiPage.get_pageViews().get_count() ; i++) {
    14.                var pageView = multiPage.get_pageViews().getPageView(i);
    15.                pageView.get_element().style.height = ($(window).height() - 80) + 'px';
    16.            }
    17.}
    18.        </script>
    19.</telerik:RadScriptBlock>
     

    The Resizing is working really great but the first time the page is loaded the initial RadPageView is not resized. You can see line 9. where I'm trying to force it but it only resizes if I change the size of the window. Is there anyway for this to work?

     Thank you.

  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 12 Oct 2015 Link to this post

    Hello Rodrigo,

    There could be a slight delay in the calculation of the initial height of the PageView, which could be applied at a later stage, then you are setting in. This is why, I would suggest you to place the ResizePage in a slight timeout and test the behavior again.

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rodrigo
    Rodrigo avatar
    6 posts
    Member since:
    Oct 2015

    Posted 12 Oct 2015 in reply to Nencho Link to this post

    Hello Nencho,

     I didn't mention in my post but I already tried doing that with the following:

    $(document).ready(function () {
        $(window).resize(function () {
            ResizePage($find('<%= ContactsPagesViews.ClientID %>'));
        });
     
        $(window).setTimeout(function () {
            ResizePage($find('<%= ContactsPagesViews.ClientID %>'));
        }, 5000); //big number here just to try it out
    });

    Another thing I tried was accessing directly to the rendered HTML ID's and setting the size. This worked but it's far from ideal and want to search for some other solution

    $(document).ready(function () {
        $(window).resize(function () {
            ResizePage($find('<%= ContactsPagesViews.ClientID %>'));
        });
     
        $("#ctl00_ContentPlaceHolder2_ContactsPagesViews").height('100%');
        $("#ContentPlaceHolder2_RadPageView1").height('100%');
        $("#ctl00_ContentPlaceHolder2_RadGrid1_GridData").height($(window).height() - 210);
    });

    Any other ideas are more than welcome

     Thank you,

    Rodrigo

     

  5. Rodrigo
    Rodrigo avatar
    6 posts
    Member since:
    Oct 2015

    Posted 12 Oct 2015 Link to this post

    Anothing thing.

     I created the same post here since I though it would be a better place for it but couldn't delete this one.

  6. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 14 Oct 2015 Link to this post

    Hello Rodrigo,

    In order to avoid duplication, I would like to ask you to continue the correspondence in the other (the referenced) forum thread.

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017