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

Issue: Traverse nested tables on client

13 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aniket
Top achievements
Rank 1
Aniket asked on 15 Dec 2015, 08:22 PM

Hi,

 I have nested checkboxes when I select a checkbox it should select all the checkboxes below as well and same when I deselect top most checkbox. However this isn't happening. I have the following code.

 aspx:

<telerik:RadGrid ID="rgExpiringServices" OnNeedDataSource="rgExpiringServices_NeedDataSource" OnItemCommand="rgExpiringServices_ItemCommand" AllowFilteringByColumn="true" OnPreRender="rgExpiringServices_PreRender" runat="server" Skin="Black" AllowMultiRowSelection="true">
        <ClientSettings Selecting-AllowRowSelect="true" Selecting-UseClientSelectColumnOnly="true" ClientEvents-OnRowSelected="nestedGridRowSelected" ClientEvents-OnRowDeselected="nestedGridRowDeselected"></ClientSettings>
        <MasterTableView DataKeyNames="ObjectId, Name" AutoGenerateColumns="false" ShowFooter="true" HierarchyLoadMode="ServerOnDemand" EnableHierarchyExpandAll="true" AllowFilteringByColumn="true">
            <Columns>
                <telerik:GridClientSelectColumn UniqueName="BulkActionSelect" HeaderText="<%$ Resources:NrttLanguage, BulkAction %>"  ></telerik:GridClientSelectColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" ButtonCssClass="btnTiny btnApprove" UniqueName="Renew" CommandName="Renew" ImageUrl="~/Images/blank16.png" HeaderStyle-Width="16px" ItemStyle-Width="16px" ></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" ButtonCssClass="btnTiny btnDelete" UniqueName="Terminate" CommandName="Terminate" ImageUrl="~/Images/blank16.png" HeaderStyle-Width="16px" ItemStyle-Width="16px" ></telerik:GridButtonColumn>
                <telerik:GridNumericColumn UniqueName="Name" DataField="Name" HeaderText="<%$ Resources:NrttLanguage, CustomerReference %>" DataType="System.String"> </telerik:GridNumericColumn>
                <telerik:GridDateTimeColumn DataField="DateExpiration" DataType="System.DateTime" FilterControlAltText="Filter DateImportant column" HeaderText="<%$ Resources:NrttLanguage, DateExpiring%>" SortExpression="DateImportant" UniqueName="DateImportant" DataFormatString="{0:d}" >
                </telerik:GridDateTimeColumn>
                <telerik:GridNumericColumn UniqueName="Daysuntilexpired" DataField="DaysUntilExpiration" HeaderText="<%$ Resources:NrttLanguage, daysuntilexpired %>" > </telerik:GridNumericColumn>
                <telerik:GridBoundColumn UniqueName="Services" DataField="ServiceInReferenceString" HeaderText="<%$ Resources:NrttLanguage, Services %>" ></telerik:GridBoundColumn>
                <telerik:GridNumericColumn UniqueName="Parcelcount" DataField="RealInReference" HeaderText="<%$ Resources:NrttLanguage, ParcelCount %>" > </telerik:GridNumericColumn>
            </Columns>
            <NestedViewTemplate>
                <nrtt:CustomerGrid ID="ucExpiringRealServices" runat="server" AllowSelection="true" OnNeedDataSource="ucExpiringRealServices_NeedDataSource" OnNeedColumnCollection="ucExpiringRealServices_NeedColumnCollection" OnItemDataBound="ucExpiringRealServices_ItemDataBound" ></nrtt:CustomerGrid>
            </NestedViewTemplate>
        </MasterTableView>
    </telerik:RadGrid>

 

 

JavaScript:

function nestedGridRowSelected(sender, args) {
    var item = args.get_gridDataItem();
    var nv = item.get_nestedViews();
    if (nv !== undefined && nv !== null) {
        nv.selectAllItems();
    } else {
        //is child
        var mt = sender.get_masterTableView();
        var dtv = args.get_tableView();
        mt.selectItem(dtv.get_parentRow());
    }
}
 
function nestedGridRowDeselected(sender, args) {
    var item = args.get_gridDataItem();
    var nv = item.get_nestedViews()[0];
    if (nv !== undefined && nv !== null) {
        nv.clearSelectedItems();
    } else {
        //is child
        var mt = sender.get_masterTableView();
        var dtv = args.get_tableView();
        mt.selectItem(dtv.get_parentRow());
    }
}

When I debug it tells me that item.get_nestedViews() is undefined. Any help appreciated.

 Thanks!

 

 

13 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 17 Dec 2015, 01:46 PM
Hello Aniket,

I am afraid the property returns a table view client object only when using a detail GridTableView and will not work for a cases when you are using a NestedViewTemplate. The reason is that you make have a different controls in the template and not only a GridTableView.


Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Aniket
Top achievements
Rank 1
answered on 17 Dec 2015, 03:24 PM

So I figured a workaround, but when I try to select all the following line is returning length 0 in the nestedGridRowSelected function: 

var matches = $("#" + childId + " input[type='checkbox']");

 function nestedGridRowSelected(sender, args) {
    var myId = args._id;
    var myMatches = ("#" + myId + " span");
    var childId;
    $(myMatches).each(function () { if ($(this).attr("data-customergridid")) { childId = $(this).attr("data-customergridid") } });
    var matches = $("#" + childId + " input[type='checkbox']");
    matches.prop("checked", true);
}

function nestedGridRowDeselected(sender, args) {
    var myId = args._id;
    var myMatches = ("#" + myId + " span");
    var childId;
    $(myMatches).each(function () { if ($(this).attr("data-customergridid")) { childId = $(this).attr("data-customergridid") } });
    //if (childId.is("input ")) {
    var matches = $("#" + childId + " input[type='checkbox']");
    $(matches).prop('checked', true);
    //}
}

 

0
Kostadin
Telerik team
answered on 21 Dec 2015, 09:21 AM
Hi Aniket,

I am afraid based on the provided information it will be hard to pinpoint the cause for this issue. I examine your code and I assume that you are using a UserControl which have a grid. Could you please verify that the control is a RadGrid? In such case you can try getting the grid client object by using findControl method. When you access the grid you can use its client API to loop though its data items and select the rows that you need.
If you are still not able to achieve your goal I would appreciate if you can provide a small runnable sample which I can examine locally.

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Aniket
Top achievements
Rank 1
answered on 21 Dec 2015, 04:03 PM

Below is just the outputted file with html and javascript. And yes I am using radgrid. 

<html>
<head><title>Sample</title></head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>


<script type="text/javascript">
  function nestedGridRowSelected(myId) {
      var myMatches = ("#" + myId + " span");
      var childId;
      $(myMatches).each(function () { if ($(this).attr("data-customergridid")) { childId = $(this).attr("data-customergridid") } });
      var matches = $("#" + childId + " input[type='checkbox']");
      matches.prop("checked", true);
  }
  
</script>
<div id="ctl00_MainContent_rgExpiringServices" class="RadGrid RadGrid_Black" pagerstyle="AlwaysVisible" tabindex="0">
<table class="rgMasterTable" id="ctl00_MainContent_rgExpiringServices_ctl00" style="width:100%;table-layout:auto;empty-cells:show;">
<thead>
<tr>
<th scope="col"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl02$ctl01$GECAllBtnExpandColumn" value=" " id="ctl00_MainContent_rgExpiringServices_ctl00_ctl02_ctl01_GECAllBtnExpandColumn" class="rgExpand" style="display:;"></th><th scope="col" class="rgHeader rgCheck"><input id="ctl00_MainContent_rgExpiringServices_ctl00_ctl02_ctl01_BulkActionSelectSelectCheckBox" type="checkbox" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl02$ctl01$BulkActionSelectSelectCheckBox" onclick="$find(&quot;ctl00_MainContent_rgExpiringServices&quot;)._selectAllRows(&quot;ctl00_MainContent_rgExpiringServices_ctl00&quot;, &quot;&quot;, event);"></th><th scope="col" class="rgHeader">&nbsp;</th><th scope="col" class="rgHeader">&nbsp;</th><th scope="col" class="rgHeader">Account</th><th scope="col" class="rgHeader">Date Expiring</th><th scope="col" class="rgHeader">Days Until Expired</th><th scope="col" class="rgHeader">Services</th><th scope="col" class="rgHeader">Count</th>
</tr>

</thead><tbody>
<tr class="rgRow" id="ctl00_MainContent_rgExpiringServices_ctl00__0">
<td class="rgExpandCol"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl04$GECBtnExpandColumn" value=" " id="ctl00_MainContent_rgExpiringServices_ctl00_ctl04_GECBtnExpandColumn" title="Collapse" class="rgCollapse"></td><td>Main <span data-customergridid="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices"><input id="ctl00_MainContent_rgExpiringServices_ctl00_ctl04_BulkActionSelectSelectCheckBox" type="checkbox" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl04$BulkActionSelectSelectCheckBox" onclick="nestedGridRowSelected('ctl00_MainContent_rgExpiringServices_ctl00__0')"></span></td><td style="width:16px;">Order / Term</td><td>IL-7797</td><td>1/22/2015</td><td>-330</td><td>&nbsp;</td><td>3</td>
</tr><tr>
<td class="rgExpandCol" style="border-right-width:0;">&nbsp;</td><td align="left" valign="top" colspan="8" style="border-left-width:0;overflow:visible;">
                <div id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid" class="RadGrid RadGrid_Black" tabindex="0">

<table class="rgMasterTable" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00" style="width:100%;table-layout:auto;empty-cells:show;">
<colgroup>
<col style="width:16px">
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th scope="col" class="rgHeader rgCheck"><input id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl01_BulkActionSelectSelectCheckBox" type="checkbox" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$BulkActionSelectSelectCheckBox" onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._selectAllRows(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;&quot;, event);"></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'Pin'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl00','')">PIN</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'Addresses'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl01','')">Address</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'County'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl02','')">County</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'Owner'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl03','')">Owner</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'Service'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl04','')">Service</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'DateExpiring'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl05','')">Date Expiring</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'Dateuntilexpiring'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl06','')">Days Until Expired</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'TimesExtended'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl07','')">Times Extended</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'ExtensionsAvailable'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl08','')">Extension Available</a></th><th scope="col" class="rgHeader"><a onclick="Telerik.Web.UI.Grid.Sort($find('ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00'), 'F1A4658C4332E51180CEBC764E11BB2F'); return false;" title="Click here to sort" href="javascript:__doPostBack('ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl01$ctl09','')">Escrowed</a></th>
</tr><tr class="rgFilterRow">
<td>&nbsp;</td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_Pin" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_Pin" class="rgFilterBox" alt="Filter Pin column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_Pin" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;Pin&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_Pin" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_Addresses" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_Addresses" class="rgFilterBox" alt="Filter Addresses column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_Addresses" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;Addresses&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_Addresses" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_County" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_County" class="rgFilterBox" alt="Filter County column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_County" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;County&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_County" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_Owner" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_Owner" class="rgFilterBox" alt="Filter Owner column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_Owner" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;Owner&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_Owner" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_Service" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_Service" class="rgFilterBox" alt="Filter Service column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_Service" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;Service&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_Service" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_DateExpiring" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_DateExpiring" class="rgFilterBox" alt="Filter DateExpiring column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_DateExpiring" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;DateExpiring&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_DateExpiring" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_Dateuntilexpiring" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_Dateuntilexpiring" class="rgFilterBox" alt="Filter Dateuntilexpiring column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_Dateuntilexpiring" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;Dateuntilexpiring&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_Dateuntilexpiring" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_TimesExtended" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_TimesExtended" class="rgFilterBox" alt="Filter TimesExtended column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_TimesExtended" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;TimesExtended&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_TimesExtended" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_ExtensionsAvailable" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_ExtensionsAvailable" class="rgFilterBox" alt="Filter ExtensionsAvailable column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_ExtensionsAvailable" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;ExtensionsAvailable&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_ExtensionsAvailable" title="Filter" class="rgFilter"></td><td style="white-space:nowrap;"><input name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$FilterTextBox_F1A4658C4332E51180CEBC764E11BB2F" type="text" size="10" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_FilterTextBox_F1A4658C4332E51180CEBC764E11BB2F" class="rgFilterBox" alt="Filter F1A4658C4332E51180CEBC764E11BB2F column" onkeypress="if((event.keyCode == 13)) return false;" style="width:70%;"><input type="submit" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl02$ctl02$Filter_F1A4658C4332E51180CEBC764E11BB2F" value=" " onclick="$find(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid&quot;)._showFilterMenu(&quot;ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00&quot;, &quot;F1A4658C4332E51180CEBC764E11BB2F&quot;, event); return false;" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl02_ctl02_Filter_F1A4658C4332E51180CEBC764E11BB2F" title="Filter" class="rgFilter"></td>
</tr>
</thead>
<tbody>
<tr class="rgRow" id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00__0">
<td style="width:16px;"><input id="ctl00_MainContent_rgExpiringServices_ctl00_ctl06_ucExpiringRealServices_rgCustomerGrid_ctl00_ctl04_BulkActionSelectSelectCheckBox" type="checkbox" name="ctl00$MainContent$rgExpiringServices$ctl00$ctl06$ucExpiringRealServices$rgCustomerGrid$ctl00$ctl04$BulkActionSelectSelectCheckBox"></td><td class="nowrap">Some Id</td><td>Some Address</td><td>Some County, ST</td><td>Some Owner</td><td>Some Service</td><td>1/22/2015</td><td>-330</td><td>0</td><td>2</td><td>Y</td>
</tr>
</tbody>

</table><div id="ctl00_MainContent_rgExpiringServices_SharedCalendarContainer" style="display:none;">
<div id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_wrapper" style="display:none;">
<table id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar" summary="Calendar control which enables the selection of dates." cellspacing="0" class="RadCalendar RadCalendar_Black">
<caption>
<span style="display:none;">Calendar</span>
</caption><thead>
<tr>
<td class="rcTitlebar"><table cellspacing="0" summary="Title and navigation which can change and show the current year and month.">
<caption>
<span style="display:none;">Title and navigation</span>
</caption><thead>
<tr style="display:none;">
<th scope="col">Title and navigation</th>
</tr>
</thead><tbody>
<tr>
<td><a id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_FNP" class="rcFastPrev" title="<<" href="#">&lt;&lt;</a></td><td><a id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_NP" class="rcPrev" title="<" href="#">&lt;</a></td><td id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Title" class="rcTitle">December 2015</td><td><a id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_NN" class="rcNext" title=">" href="#">&gt;</a></td><td><a id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_FNN" class="rcFastNext" title=">>" href="#">&lt;&lt;</a></td>
</tr>
</tbody>
</table></td>
</tr>
</thead><tbody>
<tr> <td class="rcMain"><table id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top" class="rcMainTable" cellspacing="0" summary="Table containing all dates for the currently selected month.">
<caption>
<span style="display:none;">December 2015</span>
</caption><thead>
<tr class="rcWeek">
<th class="rcViewSel" scope="col">&nbsp;</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_1" title="Sunday" scope="col" abbr="Sun">S</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_2" title="Monday" scope="col" abbr="Mon">M</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_3" title="Tuesday" scope="col" abbr="Tue">T</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_4" title="Wednesday" scope="col" abbr="Wed">W</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_5" title="Thursday" scope="col" abbr="Thu">T</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_6" title="Friday" scope="col" abbr="Fri">F</th><th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_cs_7" title="Saturday" scope="col" abbr="Sat">S</th>
</tr>
</thead><tbody>
<tr class="rcRow">
<th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_rs_1" scope="row">49</th><td class="rcOtherMonth" title="Sunday, November 29, 2015"><a href="#">29</a></td><td class="rcOtherMonth" title="Monday, November 30, 2015"><a href="#">30</a></td><td title="Tuesday, December 01, 2015"><a href="#">1</a></td><td title="Wednesday, December 02, 2015"><a href="#">2</a></td><td title="Thursday, December 03, 2015"><a href="#">3</a></td><td title="Friday, December 04, 2015"><a href="#">4</a></td><td class="rcWeekend" title="Saturday, December 05, 2015"><a href="#">5</a></td>
</tr><tr class="rcRow">
<th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_rs_2" scope="row">50</th><td class="rcWeekend" title="Sunday, December 06, 2015"><a href="#">6</a></td><td title="Monday, December 07, 2015"><a href="#">7</a></td><td title="Tuesday, December 08, 2015"><a href="#">8</a></td><td title="Wednesday, December 09, 2015"><a href="#">9</a></td><td title="Thursday, December 10, 2015"><a href="#">10</a></td><td title="Friday, December 11, 2015"><a href="#">11</a></td><td class="rcWeekend" title="Saturday, December 12, 2015"><a href="#">12</a></td>
</tr><tr class="rcRow">
<th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_rs_3" scope="row">51</th><td class="rcWeekend" title="Sunday, December 13, 2015"><a href="#">13</a></td><td title="Monday, December 14, 2015"><a href="#">14</a></td><td title="Tuesday, December 15, 2015"><a href="#">15</a></td><td title="Wednesday, December 16, 2015"><a href="#">16</a></td><td title="Thursday, December 17, 2015"><a href="#">17</a></td><td title="Friday, December 18, 2015"><a href="#">18</a></td><td class="rcWeekend" title="Saturday, December 19, 2015"><a href="#">19</a></td>
</tr><tr class="rcRow">
<th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_rs_4" scope="row">52</th><td class="rcWeekend" title="Sunday, December 20, 2015"><a href="#">20</a></td><td title="Monday, December 21, 2015"><a href="#">21</a></td><td title="Tuesday, December 22, 2015"><a href="#">22</a></td><td title="Wednesday, December 23, 2015"><a href="#">23</a></td><td title="Thursday, December 24, 2015"><a href="#">24</a></td><td title="Friday, December 25, 2015"><a href="#">25</a></td><td class="rcWeekend" title="Saturday, December 26, 2015"><a href="#">26</a></td>
</tr><tr class="rcRow">
<th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_rs_5" scope="row">1</th><td class="rcWeekend" title="Sunday, December 27, 2015"><a href="#">27</a></td><td title="Monday, December 28, 2015"><a href="#">28</a></td><td title="Tuesday, December 29, 2015"><a href="#">29</a></td><td title="Wednesday, December 30, 2015"><a href="#">30</a></td><td title="Thursday, December 31, 2015"><a href="#">31</a></td><td class="rcOtherMonth" title="Friday, January 01, 2016"><a href="#">1</a></td><td class="rcOtherMonth" title="Saturday, January 02, 2016"><a href="#">2</a></td>
</tr><tr class="rcRow">
<th id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_Top_rs_6" scope="row">2</th><td class="rcOtherMonth" title="Sunday, January 03, 2016"><a href="#">3</a></td><td class="rcOtherMonth" title="Monday, January 04, 2016"><a href="#">4</a></td><td class="rcOtherMonth" title="Tuesday, January 05, 2016"><a href="#">5</a></td><td class="rcOtherMonth" title="Wednesday, January 06, 2016"><a href="#">6</a></td><td class="rcOtherMonth" title="Thursday, January 07, 2016"><a href="#">7</a></td><td class="rcOtherMonth" title="Friday, January 08, 2016"><a href="#">8</a></td><td class="rcOtherMonth" title="Saturday, January 09, 2016"><a href="#">9</a></td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table><input type="hidden" name="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_SD" id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_SD" value="[]"><input type="hidden" name="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_AD" id="ctl00_MainContent_rgExpiringServices_gdtcSharedCalendar_AD" value="[[1900,1,1],[2099,12,31],[2015,12,18]]">
</div>
</div><input id="ctl00_MainContent_rgExpiringServices_ClientState" name="ctl00_MainContent_rgExpiringServices_ClientState" type="hidden" autocomplete="off"> </div>


</body>
</html>

0
Konstantin Dikov
Telerik team
answered on 22 Dec 2015, 02:12 PM
Hello,

Please have in mind that posting the generated HTML does not provide any inside on the scenario and you should post code snippets of the markup and the code-behind.

As for the particular requirement, please follow the suggestion from the previous post:
"you can try getting the grid client object by using findControl method. When you access the grid you can use its client API to loop though its data items and select the rows that you need. "

Please note that the NestedViewTemplate will be generated as a TR element in the parent RadGrid, so once you get reference to the TR element corresponding to the data item from the parent grid, you need to use the findControl method for the next TR element in the data table.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Aniket
Top achievements
Rank 1
answered on 22 Dec 2015, 02:56 PM

So the issue is that we are auto generating the id on the fly so we don't know what the id is.Below is code all aspx, C# and javascript code. The C# code that is relevant is the following line and the 2 methods which are important are nestedGridRowSelected(sender, args) and nestedGridRowDeselected(sender, args):

checkBox.Attributes.Add("data-customergridid", ucQuoteRows.ClientID);

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using FNA.NRTT.Website.Common;
using FNA.NRTT.Website.Customer.UserControls;
using FNA.NRTT.Website.Customer.UmbrellaService;
using System.Data;
 
namespace FNA.NRTT.Website.Customer.Service
{
    public partial class ExpiringServices : BaseCustomerPage
    {
        protected Guid[] ProcessingIds
        {
            get
            {
                return ViewState["ProcessingIds"] != null ? (Guid[])ViewState["ProcessingIds"] : new Guid[0];
            }
            set
            {
                if (value == null)
                {
                    ViewState.Remove("ProcessingIds");
                }
                else
                {
                    ViewState["ProcessingIds"] = value;
                }
            }
        }
 
        protected Guid? TerminationRequestId
        {
            get
            {
                return ViewState["TerminationRequestId"] != null ? (Guid)ViewState["TerminationRequestId"] : (Guid?)null;
            }
            set
            {
                ViewState["TerminationRequestId"] = value;
            }
        }
              
 
        List<Guid> DisabledIds = new List<Guid>();
        public void rbtnSubmitSelection_Click(object sender, EventArgs e)
        {
            if (rgExpiringServices.SelectedItems.Count > 0)
            {
                List<RenewData> data = new List<RenewData>();
                var customerId = Guid.Parse(RetrieveSavedVar(Constants.CURRENT_CUSTOMER_ID).ToString());
                 
                foreach (GridDataItem line in rgExpiringServices.SelectedItems)
                {
                    var accountNumber = line.GetDataKeyValue("Name").ToString();
                    var ucQuoteRows = line.ChildItem.FindControl("ucExpiringRealServices") as UserControls.CustomerGrid;
 
                    if(ucQuoteRows != null)
                    {
                        foreach (GridDataItem childGrid in ucQuoteRows.SelectedItems)
                        {
                            RenewData item = new RenewData();
                            var pinNumber = childGrid.GetDataKeyValue("RealEstateId").ToString();
                            var propertyServiceId = childGrid.GetDataKeyValue("PropertyServiceId").ToString();
                            var CustomerReferenceObjectId = line.GetDataKeyValue("ObjectId").ToString();
                            var TimesExtended = childGrid.GetDataKeyValue("TimesExtended").ToString();
                            var ExtensionAvailable = childGrid.GetDataKeyValue("TimeRemaining").ToString();
 
                            item.CustomerReferenceId = accountNumber;
                            item.CustomerReferenceObjectId = CustomerReferenceObjectId;
                            item.PropertyServiceId = propertyServiceId;
                            item.RealEstateId = pinNumber;
                            if(ExtensionAvailable == "0")
                            {
                                item.IsExtendable = true;
                            }
                            data.Add(item);
 
                            /*term.CustomerId = customerId;
                            term.Name = "";
                            term.DateRequested = DateTime.Now;
                            servicesRequesteds.Add(new Guid(propertyServiceId));*/
                        }
                        //term.ServicesRequested = servicesRequesteds.ToArray();
                        //terminate = term;
                    }
                }
                if(Extend.Checked == true)
                {
                    Boolean extendable = false;
                    foreach (var group in data.GroupBy(c => c.CustomerReferenceId))
                    {
                        var newOrder = BuildOrder(group.First().CustomerReferenceId, ServiceOrderType.Extension);
                        var crit = new RealEstateCriteria() { IsActive = true, CustomerId = customerId, CustomerReferenceId = newOrder.CustomerReferenceId };
                        var existingReal = DataAccess.RealEstateSearch(crit);
                        foreach (RenewData renewProp in group)
                        {  
                            if(renewProp.IsExtendable == true)
                            {
                                extendable = true;
                            }
                            else
                            {
                                var matches = existingReal.Where(c => Guid.Parse(c.ObjectId) == Guid.Parse(renewProp.RealEstateId));
                                newOrder.VerifiedProperties = matches.ToArray();
 
                                var order = DataAccess.ServiceOrderSave(newOrder);
                                var fullSavedOrder = DataAccess.ServiceOrderRetrieve(order.ResultObject.ObjectId);
                                var confirmationId = DataAccess.ServiceOrderSubmit(fullSavedOrder);
                                DisplayMessage(Resources.NrttLanguage.RenewSuccess, Resources.NrttLanguage.SuccessfulExtenededPayment, DisplaySeverity.WebInfo, "~/Service/ExpiringServices.aspx");
                            }
                        }
                    }
                    if(extendable == true)
                    {
                        System.Windows.Forms.MessageBox.Show("One or more of your selections has been extended the maximum number of times. That property service is now in the Renewable Services table.");
                    }
                     
                }
                else if (Terminate.Checked == true)
                {
                    TerminationRequest terminate = new TerminationRequest();
                    List<Guid> servicesRequesteds = new List<Guid>();
                    terminate.CustomerId = customerId;
                    terminate.Name = "";
                    terminate.DateRequested = DateTime.Now;
                    foreach(var items in data)
                    {
                        servicesRequesteds.Add(new Guid(items.PropertyServiceId));
                    }
                    terminate.ServicesRequested = servicesRequesteds.ToArray();
 
                    var createResult = DataAccess.TerminationRequestCreate(terminate);
                    TerminationRequestId = Guid.Parse(createResult.ObjectId);
                    var retrieveResult = DataAccess.TerminationRequestRetrieve(createResult.ObjectId);
                    DataAccess.TerminationRequestSubmit(retrieveResult);
 
                    DisplayMessage(Resources.NrttLanguage.TerminateSuccess, Resources.NrttLanguage.SuccessfulTerminationPayment, DisplaySeverity.WebInfo, "~/Service/ExpiringServices.aspx");
                }                      
            }
        }
 
        public void rgExpiringServices_PreRender(object sender, EventArgs e)
        {
            var thisGrid = (RadGrid)sender;
            foreach (GridDataItem dataItem in thisGrid.Items)
            {
                CheckBox checkBox = (CheckBox)dataItem["BulkActionSelect"].Controls[0];
                if (checkBox.Enabled)
                {
                    var envelopeId = Guid.Parse((string)dataItem.GetDataKeyValue("ObjectId"));
 
                    var IsProcessing = this.ProcessingIds.Contains(envelopeId);
                    checkBox.Enabled = !IsProcessing;
 
                    if (IsProcessing)
                    {
                        checkBox.ToolTip = Resources.NrttLanguage.PendingActivity;
                    }
                }
            }
        }
 
        public void rgExpiringServices_ItemCommand(object sender, GridCommandEventArgs e)
        {
            //GridHeaderItem item = (GridHeaderItem)e.Item;
            //GridDataItem item = e.Item as GridDataItem;
            if (e.Item is GridDataItem)
            {
                GridDataItem item = (GridDataItem)e.Item;
                var accountNumber = item.GetDataKeyValue("Name").ToString();
                if (e.CommandName == "Terminate")
                {
                    var customerReferenceId = item.GetDataKeyValue("ObjectId").ToString();
 
                    SetSavedVar("terminationDate", DateTime.Now);
                    SetSavedVar("reasonForTermination", "");
                    SetSavedVar("accountNumber", accountNumber);
 
                    Response.Redirect("~/Orders/TerminationRequestManage.aspx?AcctId=" + customerReferenceId);
                }
                else if (e.CommandName == "Renew")
                {
                    var customerId = Guid.Parse(RetrieveSavedVar(Constants.CURRENT_CUSTOMER_ID).ToString());
 
                    var newOrder = BuildOrder(accountNumber, ServiceOrderType.NewOrder);
                    var crit = new RealEstateCriteria() { IsActive = true, CustomerId = customerId, CustomerReferenceId = newOrder.CustomerReferenceId };
                    var existingReal = DataAccess.RealEstateSearch(crit);
                    if (existingReal.Length == 0)
                    {
                        DisplayMessage(Resources.NrttLanguage.AccountNumber + " " + newOrder.CustomerReferenceId + Resources.NrttLanguage.AccountGatheringError, Resources.NrttLanguage.AccountGatheringErrorDetail, DisplaySeverity.WebError);
                        return;
                    }
                    newOrder.VerifiedProperties = existingReal;
 
                    var order = DataAccess.ServiceOrderSave(newOrder);
                    if (order.IsSuccessful)
                    {
                        //DisplayMessage("Order Successfully Saved", "Validate or Submit to Proceed.", DisplaySeverity.WebInfo);
                        SetSavedVar(Constants.PERSISTENT_OBJECT_ID, order.ResultObject.ObjectId);
                        /*
                        if (ucImpersonate.AllowImpersonation)
                        {
                            Session.Remove("ImpersonatingId");
                        }
                         */
                        Response.Redirect("~/Orders/ManageOrderServices.aspx");
                    }
                    else
                    {
                        DisplayMessage(Resources.NrttLanguage.OrderFailedToSave, order.FriendlyErrorMessage, DisplaySeverity.WebError);
                    }
                }
            }
             
             
            if (e.CommandName == RadGrid.ExpandCollapseCommandName && e.Item.Expanded == false)
            {
                BindChildGrid(((GridDataItem)e.Item));
            }
            else if (e.CommandName == RadGrid.ExpandCollapseAllCommandName)
            {
                var thisGrid = (RadGrid)sender;
                foreach (GridDataItem parentItem in thisGrid.Items)
                {
                    if (!parentItem.Expanded)
                    {
                        BindChildGrid(parentItem);
                    }
                }
            }
             
        }
 
        protected void ddlInterval_SelectedIndexChanged(object sender, EventArgs e)
        {
            rgExpiringServices.Rebind();
        }
 
        protected void BindChildGrid(GridDataItem parentItem)
        {
            var ucQuoteRows = parentItem.ChildItem.FindControl("ucExpiringRealServices") as UserControls.CustomerGrid;
            CheckBox checkBox = (CheckBox)parentItem["BulkActionSelect"].Controls[0];
             
            if (ucQuoteRows != null)
            {
                checkBox.Attributes.Add("data-customergridid", ucQuoteRows.ClientID);
                //var envelopeName = parentItem.GetDataKeyValue("Name");
                ucQuoteRows.ParentId = parentItem.GetDataKeyValue("ObjectId").ToString();
                /*ucQuoteRows.ExportFileNamePrefix = envelopeName.ToString();
                ucQuoteRows.TaInfoEnable = RoleEngine.CurrentUserHasTARead();*/
                //BindCustomerGrid(ucQuoteRows, null);
                if (parentItem.SelectableMode == GridItemSelectableMode.None)
                {
                    ucQuoteRows.AllowSelection = false;
                }
                else if (parentItem.SelectableMode == GridItemSelectableMode.ServerAndClientSide)
                {
                    ucQuoteRows.AllowSelection = true;
                }
                ucQuoteRows.ColumnCollection = null;
                ucQuoteRows.Rebind();
            }
        }
 
        /*protected void BindCustomerGrid(UserControls.CustomerGrid grid, TaxLineItemCriteria crit)
        {
            if (crit == null)
            {
                crit = new TaxLineItemCriteria() { CustomerId = CurrentCustomerId.Value, /*EnvelopeId = grid.EnvelopeId, IsActive = true };
            }
 
            //grid.CdfDefinition = GetCdfDefinitions();
            //grid.CustomerDefinedFields = DataAccess.CustomerDefinedFieldSearch(new CustomerDefinedFieldCriteria() { CustomerId = CurrentCustomerId, IsPayment = true });
            //grid.DataSource = DataAccess.TaxLineItemReport(crit).Where(l => (int)l.CustomerStatus <= (int)TPSCustomerStatus.Funding).ToArray();
            //grid.DataSource = DataAccess.TaxLineItemWrappedReport(crit).Where(l => l.Data.CustomerStatus == TPSCustomerStatus.None).ToArray();
            //this ends up in NeedDataSource //grid.DataBind();
        }*/
 
        public void rgExpiringServices_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            var pendingOrders = DataAccess.ServiceOrderSearch(new ServiceOrderCriteria() { CustomerId = CurrentCustomerId.Value, IsActive = true, IsReadOnly = false });
            Nullable<int> numberOfDays = null;
            if (ddlInterval.SelectedValue == "0")
            {
                numberOfDays = 30;
            }
            else if(ddlInterval.SelectedValue == "1")
            {
                numberOfDays = 90;
            }
            else if (ddlInterval.SelectedValue == "2")
            {
                numberOfDays = null;
            }
            var quotes = DataAccess.CustomerReferenceExpiringReport(new CustomerReferenceExpiringCriteria() { IsActive = true, CustomerId = CurrentCustomerId.Value, MaxDaysToExpiration = numberOfDays }).OrderBy(env => env.DaysUntilExpiration); //for reference Descending(env => env.IsUrgent).ThenBy(env => env.DateImportant);
            ((RadGrid)sender).DataSource = quotes;
            //remove pending orders from quotes
            foreach(CustomerReferenceExpiring all in quotes)
            {
                foreach(ServiceOrder pending in pendingOrders)
                {
                    if(all.Name == pending.CustomerReferenceId)
                    {
                        DisabledIds.Add(Guid.Parse(all.ObjectId));
                    }
                         
                }
            }
        }
 
        protected void ucExpiringRealServices_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            //var myParent = FindFirstControlParent((CustomerGrid)sender);
            var grid = (CustomerGrid)sender;
            var referenceId = grid.ParentId;
            if (String.IsNullOrEmpty(grid.ParentId))
            {
                return;
            }
 
            Nullable<int> numberOfDays = null;
            if (ddlInterval.SelectedValue == "0")
            {
                numberOfDays = 30;
            }
            else if (ddlInterval.SelectedValue == "1")
            {
                numberOfDays = 90;
            }
            else if (ddlInterval.SelectedValue == "2")
            {
                numberOfDays = null;
            }
 
            var fullSource = DataAccess.CustomerRealEstateExpiringWrappedReport(new CustomerRealEstateExpiringCriteria() { IsActive = true, CustomerId = CurrentCustomerId, CustomerReferenceObjectId = Guid.Parse(referenceId.ToString()), MaxDaysToExpiration = numberOfDays});
            int timesAllowedToExtend = 2;
 
            //Get Extension configuration from customerId
            var customerResult = DataAccess.CustomerSettingsRetrieveByCustomerId((Guid)CurrentCustomerId);
            if (customerResult.NrttSet != null && customerResult.NrttSet.Length > 0)
            {
                var customTimes = customerResult.NrttSet.FirstOrDefault(s => Convert.ToInt32(s.Key) == (int)CustomerSettingType.DefaultExtensionsAllowed);
                if (customTimes != null)
                {
                    timesAllowedToExtend = Convert.ToInt32(customTimes.Value);
                }
            }
             
            foreach (var line in fullSource)
            {
                line.Data.TimeRemaining = timesAllowedToExtend - line.Data.TimesExtended;
                line.Data.Service = LanguageDisplay.PropertyServiceTypeDescription(line.Data.ServiceType);
                //line.Data.StatusString = LanguageDisplay.PaymentOpportunityStatusDescription(line.Data.Status);
                //line.Data.CustomerStatusString = line.Data.CustomerStatus.HasValue ? LanguageDisplay.TPSCustomerStatusDescription(line.Data.CustomerStatus.Value) : String.Empty;
            }
 
            ((CustomerGrid)sender).DataSource = CustomerFieldUtility.BuildDataTableFromFields(fullSource.ToArray(), "", GetCdfDefinitions());
        }
 
        protected void ucDisplayCDFS_NeedCdfDataDefinition(object sender, UserControlEventArgs e)
        {
            ((DisplayClientDefinedField)sender).PreferredDefinition = GetPreferredCdfDefinitions();
             
            ((DisplayClientDefinedField)sender).SetControlFromObjects(GetCdfDefinitions());
             
        }
 
        protected void ucDisplayCDFS_FilterCDFS(object sender, UserControlEventArgs e)
        {
            var selectedFields = ucDisplayCDFS.SelectedDefinitions;
            if (selectedFields == null)
            {
                SavePreferredCdfDefinitions(null);
            }
            else
            {
                SavePreferredCdfDefinitions(selectedFields.Select(g => Guid.Parse(g.ObjectId)).ToArray());
            }
            rgExpiringServices.Rebind();
        }
 
        protected void ucExpiringRealServices_NeedColumnCollection(object sender, UserControlEventArgs e)
        {
            var grid = ((CustomerGrid)sender);
            var columnList = new List<GridColumn>();
            grid.DataKeyNames = new string[] { "ObjectId", "RealEstateId", "PropertyServiceId", "TimesExtended", "TimeRemaining"};
            columnList.Add(new GridBoundColumn() { UniqueName = "Pin", DataField = "Pin", SortExpression = "Pin", DataType = typeof(String), HeaderText = Resources.NrttLanguage.Pin });
            columnList.Add(new GridBoundColumn() { UniqueName = "Addresses", DataField = "Addresses", SortExpression = "Addresses", DataType = typeof(String), HeaderText = Resources.NrttLanguage.PropertyAddress });
            columnList.Add(new GridBoundColumn() { UniqueName = "County", DataField = "CountyString", SortExpression = "County", DataType = typeof(String), HeaderText = Resources.NrttLanguage.County });
            columnList.Add(new GridBoundColumn() { UniqueName = "Owner", DataField = "Owners", SortExpression = "Owner", DataType = typeof(String), HeaderText = Resources.NrttLanguage.PropertyOwner });
            columnList.Add(new GridBoundColumn() { UniqueName = "Service", DataField = "Service", SortExpression = "Service", DataType = typeof(String), HeaderText = Resources.NrttLanguage.ServiceType });
            columnList.Add(new GridBoundColumn() { UniqueName = "DateExpiring", DataField = "DateExpiration", SortExpression = "DateExpiring", DataType = typeof(String), HeaderText = Resources.NrttLanguage.DateExpiring });
            columnList.Add(new GridBoundColumn() { UniqueName = "Dateuntilexpiring", DataField = "DaysUntilExpiration", SortExpression = "Dateuntilexpiring", DataType = typeof(String), HeaderText = Resources.NrttLanguage.daysuntilexpired });
            columnList.Add(new GridBoundColumn() { UniqueName = "TimesExtended", DataField = "TimesExtended", SortExpression = "TimesExtended", DataType = typeof(String), HeaderText = Resources.NrttLanguage.TimesExtended });
            columnList.Add(new GridBoundColumn() { UniqueName = "ExtensionsAvailable", DataField = "TimeRemaining", SortExpression = "ExtensionsAvailable", DataType = typeof(String), HeaderText = Resources.NrttLanguage.ExtensionAvailable });
             
 
            //Honor the requested fields only
            columnList.AddRange(CustomerFieldUtility.BuildColumns(GetPreferredCdfDefinitions()));
            //var customDefinitions = ucDisplayCDFS.SelectedDefinitions;
            //var resultingColumns = CustomerFieldUtility.BuildColumns(customDefinitions);
            //columnList.AddRange(resultingColumns);
 
            //nowrap columns
            var noWrapNames = new string[] { "Pin", "Name", "TAString", "Status" };
            var noWrapColumns = columnList.Where(c => noWrapNames.Contains(c.UniqueName));
            foreach (var c in noWrapColumns)
            {
                c.ItemStyle.CssClass = "nowrap";
            }
            grid.ColumnCollection = columnList.ToArray();
        }
 
        protected void ucExpiringRealServices_ItemDataBound(object sender, GridItemEventArgs e)
        {
            /*if (e.Item is GridDataItem)
            {
                var dataItem = ((GridDataItem)e.Item);
                if (dataItem.DataItem is DataRowView)
                {
                    //CheckBox checkBox = (CheckBox)dataItem["BulkActionSelect"].Controls[0];
                    var row = (DataRowView)dataItem.DataItem;
                    bool allowSelect = rbtnSubmitSelection.Enabled && (PaymentOpportunityStatus)row["Status"] == PaymentOpportunityStatus.New;
                    dataItem.SelectableMode = allowSelect ? GridItemSelectableMode.ServerAndClientSide : GridItemSelectableMode.None;
                }
            }*/
        }
 
        protected void Page_Load(object sender, EventArgs e)
        {
        }
 
        protected ServiceOrder BuildOrder(string accountNumber, ServiceOrderType type)
        {
 
            var orderType = type;
            var order = new ServiceOrder()
            {
                CustomerId = (Guid)CurrentCustomerId,
                //CustomerOrderId = ,
                CustomerReferenceId = accountNumber,
                OrderType = orderType,
                Status = OrderStatus.Unsubmitted,
            };
 
            return order;
        }
 
        protected void rgExpiringServices_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                 
                var dataItem = ((GridDataItem)e.Item);
                var ObjectId = Guid.Parse(dataItem.GetDataKeyValue("ObjectId").ToString());
 
                e.Item.SelectableMode = this.DisabledIds.Contains(ObjectId) ? GridItemSelectableMode.None : GridItemSelectableMode.ServerAndClientSide;
 
            }
        }
         
    }
}

 Aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ExpiringServices.aspx.cs" Inherits="FNA.NRTT.Website.Customer.Service.ExpiringServices" %>
<%@ Register TagPrefix="nrtt" TagName="CustomerGrid" Src="~/UserControls/CustomerGrid.ascx" %>
<%@ Register TagPrefix="nrtt" TagName="DisplayClientDefinedField" Src="~/UserControls/DisplayClientDefinedField.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <h2><asp:Literal ID="ltPageTitle" runat="server" Text="<%$ Resources:NrttLanguage, Services %>"></asp:Literal></h2>
 
    <asp:DropDownList ID="ddlInterval" runat="server" style="text-align:right" OnSelectedIndexChanged="ddlInterval_SelectedIndexChanged" AutoPostBack="true">
        <asp:ListItem Text="30 days" Value="0" />
        <asp:ListItem Text="90 days" Value="1" />
        <asp:ListItem Text="Forever" Value="2" />
    </asp:DropDownList>
    <br />
    <nrtt:DisplayClientDefinedField runat="server" ID="ucDisplayCDFS" OnNeedCdfDefinitions="ucDisplayCDFS_NeedCdfDataDefinition" OnFilterChanged="ucDisplayCDFS_FilterCDFS"/>
    <telerik:RadGrid ID="rgExpiringServices" OnNeedDataSource="rgExpiringServices_NeedDataSource" OnItemCommand="rgExpiringServices_ItemCommand" AllowFilteringByColumn="true" OnPreRender="rgExpiringServices_PreRender" runat="server" Skin="Black" AllowMultiRowSelection="true" OnItemDataBound="rgExpiringServices_ItemDataBound" AllowPaging="true" PagerStyle="AlwaysVisible">
        <ClientSettings Selecting-AllowRowSelect="true" Selecting-UseClientSelectColumnOnly="true" ClientEvents-OnRowSelected="nestedGridRowSelected" ClientEvents-OnRowDeselected="nestedGridRowDeselected"></ClientSettings>
        <MasterTableView DataKeyNames="ObjectId, Name" AutoGenerateColumns="false" ShowFooter="true" HierarchyLoadMode="ServerOnDemand" EnableHierarchyExpandAll="true" AllowFilteringByColumn="true">
            <Columns>
                <telerik:GridClientSelectColumn UniqueName="BulkActionSelect" HeaderText="<%$ Resources:NrttLanguage, BulkAction %>" ></telerik:GridClientSelectColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" ButtonCssClass="btnTiny btnApprove" UniqueName="Renew" CommandName="Renew" ImageUrl="~/Images/blank16.png" HeaderStyle-Width="16px" ItemStyle-Width="16px" ></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="ImageButton" ButtonCssClass="btnTiny btnDelete" UniqueName="Terminate" CommandName="Terminate" ImageUrl="~/Images/blank16.png" HeaderStyle-Width="16px" ItemStyle-Width="16px" ></telerik:GridButtonColumn>
                <telerik:GridNumericColumn UniqueName="Name" DataField="Name" HeaderText="<%$ Resources:NrttLanguage, CustomerReference %>" DataType="System.String"> </telerik:GridNumericColumn>
                <telerik:GridDateTimeColumn DataField="DateExpiration" DataType="System.DateTime" FilterControlAltText="Filter DateImportant column" HeaderText="<%$ Resources:NrttLanguage, DateExpiring%>" SortExpression="DateImportant" UniqueName="DateImportant" DataFormatString="{0:d}" >
                </telerik:GridDateTimeColumn>
                <telerik:GridNumericColumn UniqueName="Daysuntilexpired" DataField="DaysUntilExpiration" HeaderText="<%$ Resources:NrttLanguage, daysuntilexpired %>" > </telerik:GridNumericColumn>
                <telerik:GridBoundColumn UniqueName="Services" DataField="ServiceInReferenceString" HeaderText="<%$ Resources:NrttLanguage, Services %>" ></telerik:GridBoundColumn>
                <telerik:GridNumericColumn UniqueName="Parcelcount" DataField="RealInReference" HeaderText="<%$ Resources:NrttLanguage, ParcelCount %>" > </telerik:GridNumericColumn>
            </Columns>
            <NestedViewTemplate>
                <nrtt:CustomerGrid ID="ucExpiringRealServices" runat="server" AllowSelection="true" OnNeedDataSource="ucExpiringRealServices_NeedDataSource" OnNeedColumnCollection="ucExpiringRealServices_NeedColumnCollection" OnItemDataBound="ucExpiringRealServices_ItemDataBound" ></nrtt:CustomerGrid>
            </NestedViewTemplate>
        </MasterTableView>
    </telerik:RadGrid>
    <div style="text-align:right">
        <asp:RadioButton ID="Extend" Text="Extend" Checked="true" GroupName="whattodo" runat="server" />
        <asp:RadioButton ID="Terminate" Text="Terminate" Checked="false" GroupName="whattodo" runat="server" />
        <telerik:RadButton ID="rbtnSubmitSelection" runat="server" Text="<%$ Resources:NrttLanguage, RequestPayment %>" Skin="Black" SingleClick="true" OnClick="rbtnSubmitSelection_Click"></telerik:RadButton>
    </div>
</asp:Content>

JavaScript:

function onWindowLoaded(sender, eventArgs) {
    setTimeout(function () {
        sender.set_status("");
    }, 0);
}
 
function defaultCombo(combo, value, text) {
    combo.trackChanges();
    combo.clearItems();
    var comboItem = new Telerik.Web.UI.RadComboBoxItem();
    comboItem.set_value(value);
    comboItem.set_text(text);
    combo.get_items().add(comboItem);
    combo.commitChanges();
 
    var item = combo.findItemByText(text);
    if (item) {
        item.select();
    }
 
}
 
function cancelSelectIfRowDisabled(sender, args) {
    var id = args.get_id();
    var inputArray = $get(id).getElementsByTagName("input");
 
    jQuery.each(inputArray, function (i, val) {
        if (val.type === 'checkbox') {
            if (val.id.indexOf('SelectCheckBox') > -1) {
                var inputCheckBox = val;
                if (!inputCheckBox.checked && inputCheckBox.disabled) {
                    //cancel selection
                    args.set_cancel(true);
                    return;
                }
            }
        }
    });
}
 
function setEmptyMessage(comboBox) {
    var selectedValue = "";
    var emptyMessage = comboBox.get_emptyMessage();
    if (combo.get_selectedItem() != null) {
        selectedValue = selectedItem.get_value();
    }
    if (emptyMessage != comboBox.get_text() && selectedValue != "") {
        comboBox.set_text(emptyMessage);
        return true;
    } else {
        return false;
    }
}
 
function clearEmptyMessage(comboBox) {
    if (comboBox.get_emptyMessage() == comboBox.get_text()) {
        comboBox.set_text("");
        return true;
    } else {
        return false;
    }
}
 
function stringToBool(str) {
    var bool;
    if (str.match(/^(true|1|yes)$/i) !== null) {
        bool = true;
    } else if (str.match(/^(false|0|no)*$/i) !== null) {
        bool = false;
    } else {
        bool = null;
        if (console) console.log('"' + str + '" is not a boolean value');
    }
    return bool;
}
 
function comboRequiredValue(sender, args) {
    args.IsValid = false;
    var combo = $find(sender.controltovalidate);
    var text = combo.get_text();
    if (text.length < 1) {
        args.IsValid = false;
    }
    else {
        var node = combo.findItemByText(text);
        if (node) {
            args.IsValid = true;
        }
        else {
            args.IsValid = false;
        }
    }
}
 
function ensureComboOpen(sender, e) {
    if (!sender.get_dropDownVisible()) {
        sender.showDropDown();
        //set the max allowed height of the combo 
        //this is the single item's height 
        //var SINGLE_ITEM_HEIGHT = 22;
 
        //var calculatedHeight = sender.get_items().get_count() * SINGLE_ITEM_HEIGHT;
        /*
        if (calculatedHeight > MAX_ALLOWED_HEIGHT) {
            setTimeout(
                function () {
                    dropDownDiv.firstChild.style.height = MAX_ALLOWED_HEIGHT + "px";
                }, 20
            );
        }
        else {
            setTimeout(
                function () {
                    dropDownDiv.firstChild.style.height = calculatedHeight + "px";
                }, 20
            );
        }
        */
        //sender.repaint();
    }
 
    var MAX_ALLOWED_HEIGHT = 200;
    var dropDownDiv = sender.get_dropDownElement();
    if (dropDownDiv.firstChild.style.height != MAX_ALLOWED_HEIGHT + "px") {
        dropDownDiv.firstChild.style.height = MAX_ALLOWED_HEIGHT + "px";
    }
}
 
function comboTabComplete(comboBox, e) {
    comboTabComplete(comboBox, e, null);
}
 
function comboTabComplete(comboBox, e, childTarget) {
    var keyCode = e.get_domEvent().keyCode;
    if (keyCode == 9) {
        comboItems = comboBox.get_items();
        for (var i = 0; i < comboItems.get_count() ; i++) {
            var item = comboItems.getItem(i);
            if (item) {
                var el = item.get_element();
                var cssClass = el.className;
                if (cssClass == "rcbHovered") {
                    comboBox.trackChanges();
                    item.select();
                    comboBox.commitChanges();
                    break;
                }
            }
        }
        if (childTarget == null) {
            //comboBox.focus();
        } else {
            childTarget.focus();
        }
    }
}
 
function fillCombo(combo, result) {
    fillComboAndSaveAttribute(combo, result, null, null);
}
 
function fillComboAndSaveAttribute(combo, result, attributeToSave, controltoSaveItTo) {
    combo.trackChanges();
 
    var items = result.d || result;
 
    // Nothing found
    if (items.length == 0) {
        combo.clearItems();
        var comboItem = new Telerik.Web.UI.RadComboBoxItem();
        comboItem.set_text("Nothing found");
        comboItem.set_value("null");
        combo.get_items().add(comboItem);
        combo.set_text("");
    }
    else
    {
        // Results found!
        var json = $.parseJSON(result.d);
 
        var valueReplaced = true;
        var selectedValue = "";
        var selectedText = "";
        var selectedItem = combo.get_selectedItem();
        if (selectedItem != null) {
            selectedValue = selectedItem.get_value();
        } else {
            selectedValue = combo.get_value();
        }
        combo.clearItems();
 
        $.each(json, function (index, item) {
            var comboItem = new Telerik.Web.UI.RadComboBoxItem();
            comboItem.set_text(item.Name);
            comboItem.set_value(item.ObjectId);
            combo.get_items().add(comboItem);
            if (selectedValue != "" && item.ObjectId == selectedValue) {
                valueReplaced = false;
            }
        });
 
        if (selectedValue != "" && valueReplaced == true) {
            combo.clearSelection();
            clearEmptyMessage(combo);
        } else {
            if (selectedValue != "" || selectedText != "") {
                //text match.  Ensure selection of ID
                var item = combo.findItemByText(selectedText);
                if (item) {
                    item.select();
                }
            }
        }
        /*
        $(json).each(function (i, val) {
            $.each(val, function (k, v) {
                console.log(k + " : " + v);
            });
        });
         
         
        */
    }
 
    combo.commitChanges();
}
 
// This cancels the default RadComboBox behavior
function d(sender, args) {
    if (args.set_cancel != null) {
        args.set_cancel(true);
    }
    clearEmptyMessage(sender);
}
function nestedGridRowSelected(sender, args) {
    var myId = args._id;
    var myMatches = ("#" + myId + " span");
    var childId;
    $(myMatches).each(function () { if ($(this).attr("data-customergridid")) { childId = $(this).attr("data-customergridid") } });
    var matches = $("#" + childId + " input[type='checkbox']");
    matches.prop("checked", true);
}
 
function nestedGridRowDeselected(sender, args) {
    var myId = args._id;
    var myMatches = ("#" + myId + " span");
    var childId;
    $(myMatches).each(function () { if ($(this).attr("data-customergridid")) { childId = $(this).attr("data-customergridid") } });
    //if (childId.is("input ")) {
    var matches = $("#" + childId + " input[type='checkbox']");
    $(matches).prop('checked', true);
    //}
}

 

Thanks!

 

0
Konstantin Dikov
Telerik team
answered on 24 Dec 2015, 05:46 AM
Hi,

The $telerik.findControl method will find the control in the container by its ID and not by its ClientID, so the fact that each nested grid will have different ClientID will not prevent the method from finding the control.

Here is a very basic example for achieving this:
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function rowSelected(sender, args) {
            //if HierarchyLoadMode is set to server, please ensure that the item is expanded and the nested view is visible
            var nestedViewRow = $(args.get_gridDataItem().get_element()).next()[0];
            var nestedGrid = $telerik.findControl(nestedViewRow, "ucExpiringRealServices");
            var dataItems = nestedGrid.get_masterTableView().get_dataItems();
            for (var i = 0; i < dataItems.length; i++) {
                dataItems[i].set_selected(true); // use false within the rowDeselected event
            }
        }
    </script>
</telerik:RadCodeBlock>
 
<telerik:RadGrid runat="server" ID="RadGrid1" OnNeedDataSource="RadGrid1_NeedDataSource" ClientSettings-Selecting-AllowRowSelect="true">
    <MasterTableView HierarchyDefaultExpanded="true" HierarchyLoadMode="Client">
        <NestedViewTemplate>
            <telerik:RadGrid runat="server" ID="ucExpiringRealServices" OnNeedDataSource="RadGrid1_NeedDataSource"
                ClientSettings-Selecting-AllowRowSelect="true" AllowMultiRowSelection="true">
            </telerik:RadGrid>
        </NestedViewTemplate>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnRowSelected="rowSelected"/>
    </ClientSettings>
</telerik:RadGrid>

And the dummy data:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    DataTable table = new DataTable();
    table.Columns.Add("ID", typeof(int));
    for (int i = 0; i < 5; i++)
    {
        table.Rows.Add(i);
    }
 
    (sender as RadGrid).DataSource = table;
}


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Aniket
Top achievements
Rank 1
answered on 30 Dec 2015, 10:25 PM

This won't work since ucExpiringRealServices is a custom control. 

var nestedGrid = $telerik.findControl(nestedViewRow, "ucExpiringRealServices");

 This line is null for me when I debug on javascript side. 

0
Aniket
Top achievements
Rank 1
answered on 30 Dec 2015, 10:46 PM
So the custom grids id is auto generated so it is impossible to know the id beforehand. That is why I believe it is failing. 
0
Konstantin Dikov
Telerik team
answered on 01 Jan 2016, 10:55 AM
Hi Aniket,

In your code snippets I see that you are setting the ID property of your custom control, so I am not sure that I understand what you mean with "the custom grids id is auto generated". 

However, for custom controls you could get reference to the element by using the $telerik.findElement method instead.


Regards,
Konstantin Dikov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Aniket
Top achievements
Rank 1
answered on 04 Jan 2016, 02:37 PM

So this line is returning null. I am pretty sure it is because this is a custom control. 

var nestedGrid = $telerik.findElement(nestedViewRow, "ucExpiringRealServices");

 This is the custom control which I created but the id which is render for this control is created on server side:

<NestedViewTemplate>
                <nrtt:CustomerGrid ID="ucExpiringRealServices" runat="server" OnNeedDataSource="ucExpiringRealServices_NeedDataSource" OnNeedColumnCollection="ucExpiringRealServices_NeedColumnCollection" OnItemDataBound="ucExpiringRealServices_ItemDataBound" ></nrtt:CustomerGrid>
            </NestedViewTemplate>

0
Kostadin
Telerik team
answered on 06 Jan 2016, 01:15 PM
Hi Aniket,

Could you please let me know whether the UserControl inherits RadGrid class or not? Nevertheless, you need to pass the id of the grid and not the UserControl. From the rendered html element of the grid I noticed that the server id of the Grid is "rgCustomerGrid". Please try finding the client object of the grid by using this id instead of "ucExpiringRealServices".

Regards,
Kostadin
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Aniket
Top achievements
Rank 1
answered on 06 Jan 2016, 02:44 PM
Its working now. I had to just use pure javascript. 
Tags
Grid
Asked by
Aniket
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Aniket
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or