Setting the PanelBar Height programmatically

6 posts, 0 answers
  1. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 07 May 2008 Link to this post

    How in the name of the Gods do I do this?

    I thought that it'd be nice and simple, something like:

    var pb = $find("<%=PanelBar.ClientID%>"); 
    pb.height = "200px"
    Sadly, that doesn't work.

    Nor does setting the style.height property of the result of "get_element()".

    What I'm trying to do is have the PanelBar occupy the full height of a Splitter Pane with ExpandMode set to "FullExpandedItem". With this setting, you can't just set the height to 100% and expect it to work. The boys at telerik towers tell me that this isn't supported and it certainly doesn't work; you have to set an explicit height for the PanelBar to get any oversized child group to scroll.

    Which leaves me back at the start of this message. How do I explicitly set the height of the PanelBar?

    Why is it always the simple seeming things that take the time ...?

    --
    Stuart
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 07 May 2008 Link to this post

    Hello Stuart,

    There are two possible options for achieving your goal. Here there are:

    1)
    <script type="text/javascript">  
    function pageLoad()  
    {  
        var pb = $find("<%=RadPanelBar1.ClientID%>");    
        pb.get_element().style.height = "500px";  
    }  
    </script> 

    2)
    <script type="text/javascript">  
    function pageLoad()  
    {  
        var pb = $get("<%=RadPanelBar1.ClientID%>");    
        pb.style.height = "500px";  
    }  
    </script> 


    Best wishes,
    Paul
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 07 May 2008 Link to this post

    Cheers Paul,

    Sadly, in practice that doesn't appear to do the trick (it does resize, just not with the expected results).

    I've raised support ticket 136554 to try and solve the underlying issue.

    --
    Stuart
  5. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 08 May 2008 Link to this post

    The answer is to include in your JavaScript a call to the Panelbar's repaint() method.

    --
    Stuart
  6. Andreas Kaech
    Andreas Kaech avatar
    121 posts
    Member since:
    Sep 2004

    Posted 30 May 2008 Link to this post

    Hi Stuard,
    repaint() ? Looks like "undocumented".
    Now 2 questions:
    - In what situations we need to call this method?
    - Does other controls has this method?

    Thanks for answering,
    Andreas
  7. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 02 Jun 2008 Link to this post

    Andreas,

    You're right; repaint() is an undocumented method. I was told to use it by someone at telerik towers.

    In answer to your questions...

    1. In my case it was where the the style of the PanelBar was being changed, client-side after the control had fully rendered. In particular, in the resize event of the container (a RadSplitter).

    I can't say why this is necessary, I only know that it is. It could be something to do with the order in which controls are rendered, but that's a bit of a wild guess. If you need a more conclusive reply, you're going to need a grown-up to answer.

    2. I've not a clue. I suspect you could find out by examining the source code or my using something like FireBug in FireFox to examine the objects on your page.

    --
    Stuart
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017