This works, but is it optimal?

2 posts, 1 answers
  1. Boris
    Boris avatar
    275 posts
    Member since:
    Oct 2012

    Posted 15 Jan 2013 Link to this post

    As usual I'm on a deadline and tinkering with aspects of Telerik I don't fully understand.  
    I've been looking at your splitter demo (http://demos.telerik.com/aspnet-ajax/splitter/examples/clientsideapi/defaultcs.aspx)

    I have a form with regions divided up by splitters.  

    Like your demo I need to be able to expand and collapse the end pane in Javascript, depending on the value set in a combobox.  

    Unlike your demo, the page is supposed to start off with the endpane collapsed.  The toggle in my checkForValue function when the pane is initially collapsed,  initially didn't work.  

    To fix this, on the server side, in the Page_Load event, to initially expand the pane, I put:
     RadPaneEnd.Width = new System.Web.UI.WebControls.Unit("55%");

    On the client side, I put this, to fire on load, and collapse the pane:
      $(document).ready(function () {        
                var splitter = $find("<%=RadSplitter1.ClientID%>");
                var endPane = splitter.getEndPane();
                endPane.collapse(Telerik.Web.UI.SplitterDirection.Backward);
            })

    The expand/collapse function itself is:
      function checkForValue(sender, args) {
         var splitter = $find("<%=RadSplitter1.ClientID%>");
         var endPane = splitter.getEndPane();
         var curVal = sender.get_text();
         if (curVal == 'Value1') {
             endPane.expand(Telerik.Web.UI.SplitterDirection.Backward);
         }
         else {
            endPane.collapse(Telerik.Web.UI.SplitterDirection.Backward);
         }           
      }


  2. Answer
    Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 18 Jan 2013 Link to this post

    Hi Boris,

    I tried to reproduce the described scenario and everything behaves well on my side. The provided functions seem to be configured correctly.

    For your convenience I am attaching my test project - I attached the checkForValue() function as a handler to the RadCombobox's OnClientSelectedIndexChanged event.

    I hope this was helpful for you. Feel free to contact us if we could be of any further assistance.

    Kind regards,
    Vesi
    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
Back to Top