This is a migrated thread and some comments may be shown as answers.

Get radslider client grid.dataitem.findcontrol

4 Answers 149 Views
Slider
This is a migrated thread and some comments may be shown as answers.
cbospikes
Top achievements
Rank 1
cbospikes asked on 08 Jan 2009, 02:11 PM
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.

4 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetie
Telerik team
answered on 10 Jan 2009, 01:13 PM
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.
0
cbospikes
Top achievements
Rank 1
answered on 10 Jan 2009, 02:37 PM
cool thanks!
0
Bertrand Dessaintes
Top achievements
Rank 1
answered on 27 Jun 2009, 02:58 PM
Hello,

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

Thk you
0
Sebastian
Telerik team
answered on 30 Jun 2009, 08:10 AM
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.
Tags
Slider
Asked by
cbospikes
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
cbospikes
Top achievements
Rank 1
Bertrand Dessaintes
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or