RadSlider1.ClientID

2 posts, 0 answers
  1. neil fennessey
    neil fennessey avatar
    8 posts
    Member since:
    Mar 2008

    Posted 15 Feb 2012 Link to this post

    Hi,

    I see a few posts here on the slider.repaint(); and RadSlider1.ClientID as a possible fix.  We implemented this in order to allow a div/modal to appear without reloading the whole page.  No joy.

    Here's the code:
    function ShowDiv() {
                                var MainSearchDivID = '<%=MainSearchDiv.ClientID %>';
                                var MainD = document.getElementById(MainSearchDivID);
                                MainD.style.display = "block";

                                var btnShowDivID = '<%=btnShowDiv.ClientID %>';
                                var btnHideDivID = '<%=btnHideDiv.ClientID %>';

                                var btnShow = document.getElementById(btnShowDivID);
                                var btnHide = document.getElementById(btnHideDivID);

                                btnShow.style.display = "none";
                                btnHide.style.display = "block";
                                var slider = $find("<%= RadSlider1.ClientID %>");

                                slider.repaint();
                                return false;

                            }

    We add the ShowDiv on the link which opens the div and yet the first panel shows nothing with the slider.  The slider uses letters a through z.  When you click 'b' you'll see the values associated with letter b and when you select a, you'll see the values associated with letter a.  It is as if the radslider1.clientid isn't recognized and that's why the results aren't populating.

    Before my forehead finds the keyboard one more time...thoughts?   What are we missing.
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 16 Feb 2012 Link to this post

    Hi neil,

     
    I tested showing and repainting a slider but it works fine on my side. What I can assume is that for some reason (e.g too much HTML, etc) this happens a bit slowlier on your side. What I suggest is to try calling repaint with some small timeout (actually, 0ms usually does the trick) as follows:

    function ShowDiv() {
                                 var MainSearchDivID = '<%=MainSearchDiv.ClientID %>';
                                 var MainD = document.getElementById(MainSearchDivID);
                                 MainD.style.display = "block";
      
                                var btnShowDivID = '<%=btnShowDiv.ClientID %>';
                                 var btnHideDivID = '<%=btnHideDiv.ClientID %>';
      
                                var btnShow = document.getElementById(btnShowDivID);
                                 var btnHide = document.getElementById(btnHideDivID);
      
                                btnShow.style.display = "none";
                                 btnHide.style.display = "block";
                                 var slider = $find("<%= RadSlider1.ClientID %>");
     setTimeout(function(){
                                slider.repaint();return false;}, 0);
                                 
      
                            }

    Please, test my suggestion and in case you need further assistance, send me some fully working demo page and I will do my best to help.

    All the best,
    Svetlina Anati
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top