Get radslider client grid.dataitem.findcontrol

5 posts, 1 answers
  1. cbospikes
    cbospikes avatar
    16 posts
    Member since:
    May 2007

    Posted 08 Jan 2009 Link to this post

    Using  slider in a radgrid is perfect for a particular issue.  I have it all working except one thing.

    I have placed a radslider in the header of my radgrid and am attempting to use it as a "select all" for the radsliders in the rows of the  associated column.  OnClientValueChange I am iterating thru the griddataitems and trying to use findcontrol to get a refrence to the slider and set the value.

    I keep coming back with null.

    Am I approaching this wrong or does this control not render in a fashion that allows me to do this?
    Here is my javascript function:

    function SelectDate(sender, eventArgs)
    {

     var grid = $find("rgLoad").get_masterTableView();
     var griditems =grid.get_dataItems();
     
      for (var i=0; i<griditems.length; i++)        
            {    
             var slider = griditems[i].findControl("rslider");
             if(!slider==null)
                slider.set_value(sender.get_value());
            }


    }

    Let me know if I need to provide more info.

  2. Answer
    Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 10 Jan 2009 Link to this post

    Hello cbospikes,
    We are aware of this behavior and in case you wait for SP2 that we will release next week, griditems[i].findControl("rslider"); will return the RadSlider client object.

    For the time being, I can offer you the following workaround:
    <script type="text/javascript"
    function SelectDate(sender, eventArgs) 
        var grid = $find("rgLoad").get_masterTableView(); 
        var griditems =grid.get_dataItems(); 
     
        for (var i=0; i<griditems.length; i++)         
        {   
            var gridItemElement = griditems[i].get_element(); 
            var childElements = gridItemElement.getElementsByTagName("DIV"); 
            for(var j=0, length=childElements.length; j<length; j++) 
            { 
                var childElement = childElements[j]; 
                var childElementID = childElement.id; 
                if(Sys.UI.DomElement.containsCssClass(childElement, 'radslider') && childElementID && childElementID.endsWith('rslider')) 
                { 
                    var slider = $find(childElementID); 
                    if(slider) 
                    { 
                        slider.set_value(50); 
                    } 
                } 
            } 
        } 
    </script> 


    Regards,
    Tsvetie
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. cbospikes
    cbospikes avatar
    16 posts
    Member since:
    May 2007

    Posted 10 Jan 2009 Link to this post

    cool thanks!
  5. Bertrand Dessaintes
    Bertrand Dessaintes avatar
    13 posts
    Member since:
    Apr 2008

    Posted 27 Jun 2009 Link to this post

    Hello,

    Could you help me to find control in insert row (insertmode) ?

    Thk you
  6. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 30 Jun 2009 Link to this post

    Hello Bertrand,

    If you would like to get reference to the control in the insert item on the server, you can do that inside the ItemCreated or ItemDataBound handlers of the grid as explained here:

    http://www.telerik.com/help/aspnet-ajax/grddistinguisheditinsertmodeonitemcreateditemdatabound.html

    In case you would like to obtain reference to it on the client, consider the approach presented in the code library thread linked below:

    http://www.telerik.com/community/code-library/aspnet-ajax/grid/attaching-client-event-for-column-editors-on-init-insert.aspx

    Best regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017