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

[Solved] ClientSide set DataRow to selected

1 Answer 124 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Laz
Top achievements
Rank 1
Laz asked on 17 Jun 2009, 03:20 PM

Hi to all,
in my szenario i have a RadGrid with RadComboBoxes for every DataRow.

I have 12 DataRows and hide 10 of them, because of an Filter-Event by the user.

For the remaining 2 DataRows i change the values of the combo boxes on clientside.

Until here everything works.

But now i do a postback and would like to find the remaining 2 Datarow.
This does not work! Because i have no indicator.

The Indicator i needed i would like to set on clientside. The Indicator can be to set the datarow to selected or to check a checkbox in a GridTemplateColumn

<telerik:GridTemplateColumn> 
                          <ItemTemplate> 
                                <asp:CheckBox ID="chkbSelected" runat="server" /> 
                            </ItemTemplate> 
                        </telerik:GridTemplateColumn> 

In this the JavaScript Code in which i try to set the Datarow to selected. But on the ParentObject this doesn´t work.

        //global DOM ID registry.  filled up by scripts rendered from templates.    
        var registeredElements = [];  
        //looks for an element that has been registered with the global array    
        //requires that we emit a registration script block for each server control    
        function GetRegisteredServerElement(serverID) {  
            var clientID = "";  
            for (var i = 0; i < registeredElements.length; i++) {  
                clientID = registeredElements[i];  
                var combo           = $find(clientID);  
                //Get the parent object, because this object has the visible attribute we need  
                var ParentObject    = $find(combo.get_parent().get_id());  
                //Check whether the value exists in the RadComboBox  
                var IsObject        = combo.findItemByText(ColumnDecisonCombo.get_text());  
                //declare a the dom elements to change the backgroundColor  
                var inputArea       = combo.get_inputDomElement();                  
                //Only if the parent object is visible true and the RadComboBox contains the value  
                if (ParentObject.get_visible() && (IsObject != null)) {  
                   /////HERE i NEED HELP   
                   ParentObject.set_selected();  
 
                    combo.set_value(ColumnDecisonCombo.get_value());  
                    combo.set_text(ColumnDecisonCombo.get_text());  
                      
                    inputArea.style.backgroundColor = "green" 
                }  
                else {  
                    inputArea.style.backgroundColor = "red" 
                }  
            }  
        } 

Thanks

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 22 Jun 2009, 04:09 PM
Hello Laz,

Unfortunately I am not exactly sure what your scenario is. In my attempt to implement the required functionality I have created a test project which is attached to this support thread. Please examine it and let me know if I am missing something.

You can also review these links devoted on RadGrid's client API:
http://www.telerik.com/help/aspnet-ajax/grdgettingfamiliarwithclientapi.html
http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientsideapi/defaultcs.aspx

Best regards,
Georgi Krustev
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
Grid
Asked by
Laz
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or