Take the 2-minute tour ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I do a single select in one radgrid, and based upon that selection I want to select multiple rows in a different radgrid:

<telerik:RadGrid ID="rgPaymentLines"> <ClientEvents OnRowSelected="RowPaymentSelected"/> ... </telerik:RadGrid>

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">

        function RowPaymentSelected(sender, eventArgs) {
            var grid = $find("<%=rgPaymentLines.ClientID %>");
            var MasterTablePayment = grid.get_masterTableView();
            var paymentRow = MasterTablePayment.get_selectedItems()[0];
            var paymentCell = MasterTablePayment.getCellByColumnUniqueName(paymentRow, "DossierID")
            selectDossierRow(paymentCell.innerHTML);
        }
        function selectDossierRow(dossierID) {
            var gridDossier = $find("<%=rgDossiersAdmin.ClientID %>");
            var MasterTableDossier = gridDossier.get_masterTableView();
            var rows = MasterTableDossier.get_dataItems();

            MasterTableDossier.clearSelectedItems();
            for (var i = 0; i < rows.length; i++) {
                if (MasterTableDossier.getCellByColumnUniqueName(rows[i], "columnDossierID").innerHTML == dossierID) {
                    MasterTableDossier.selectItem(i);
                }
            }
        }
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

welcome to Code Review and thank you for your question. You need to profile the code to see for yourself where it is slow. Firebug and Chrome can do this. Only then will you be able to optimize your code.

Side note: Be careful about variable names, some of them seem to be in French (dossier).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.