Hi,
I have a problem that only seems to occurs when the HierarchyLoadMode is set to Client. I have used the client mode in other similar scenarios and have not had any problems.
I load up an intial page in a rad window. This rad window contains a user control. This user control contains a rad grid summary, amongst other things.
The rad grid summary contains a master table and one detail table. The tables are databound using NeedDataSource and DetailTableDataBind. The grid has a column containing a link that launchs a different rad window which allows you to edit and save some related data. When you close the rad window, it fires the OnWindowClose hook of the radwindow and causes an ajax post back of the control that contains the rad grid (i.e. the controls contained in the original rad window). This all works fine until you expand one of master table rows.
If you expanded one of the items,and then try to open the second rad window again by clicking on that link in the radgrid column, then close the radwindow (hence triggering the ajax update to the control containing the grid), you get the error:
"Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex"
This only occurs if HiearchyLoadMode is set to client. Setting it to ServerBind and ServerOnDemand is fine. I have the same exact setup somewhere else, and it is working ... So i must be doing something silly in this particular example. Would appreciate it if I could get some help.
The control containing the RadGrid:
This is the code that populates the grids:
This is the javascript that is called when the radwindow is closed:
This is the RefreshControils method:
This is the AjaxUpdate method
Again, any help will be much appreciated. This one has me stumped
I have a problem that only seems to occurs when the HierarchyLoadMode is set to Client. I have used the client mode in other similar scenarios and have not had any problems.
I load up an intial page in a rad window. This rad window contains a user control. This user control contains a rad grid summary, amongst other things.
The rad grid summary contains a master table and one detail table. The tables are databound using NeedDataSource and DetailTableDataBind. The grid has a column containing a link that launchs a different rad window which allows you to edit and save some related data. When you close the rad window, it fires the OnWindowClose hook of the radwindow and causes an ajax post back of the control that contains the rad grid (i.e. the controls contained in the original rad window). This all works fine until you expand one of master table rows.
If you expanded one of the items,and then try to open the second rad window again by clicking on that link in the radgrid column, then close the radwindow (hence triggering the ajax update to the control containing the grid), you get the error:
"Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex"
This only occurs if HiearchyLoadMode is set to client. Setting it to ServerBind and ServerOnDemand is fine. I have the same exact setup somewhere else, and it is working ... So i must be doing something silly in this particular example. Would appreciate it if I could get some help.
The control containing the RadGrid:
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server"> |
<AjaxSettings> |
<telerik:AjaxSetting AjaxControlID="RadGridSummary"> |
<UpdatedControls> |
<telerik:AjaxUpdatedControl ControlID="RadGridSummary" /> |
</UpdatedControls> |
</telerik:AjaxSetting> |
</AjaxSettings> |
</telerik:RadAjaxManagerProxy> |
<div class="BaseSummary" id="BaseSummaryDiv" runat="server"> |
<div class="BaseSummaryControl"> |
<telerik:RadGrid ID="RadGridSummary" runat="server" PageSize="10" AutoGenerateEditColumn="false" |
GridLines="None" BorderStyle="Solid" AllowMultiRowSelection="true"> |
<ClientSettings Selecting-AllowRowSelect="true"> |
</ClientSettings> |
<MasterTableView DataKeyNames="SecurityGuardAvailabilityTemplateId" CurrentResetPageIndexAction="SetPageIndexToFirst" |
Dir="LTR" TableLayout="Auto" Frame="void" CommandItemDisplay="None" GridLines="Horizontal" HierarchyLoadMode="Client" |
AutoGenerateColumns="false"> |
<NoRecordsTemplate> |
<div> |
There are no records to display</div> |
</NoRecordsTemplate> |
<Columns> |
<telerik:GridTemplateColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
ForceExtractValue="None" HeaderText="Availability Times" UniqueName="ShiftName"> |
<ItemTemplate> |
<asp:Label ID="guardAvailabilityTime" runat="server"></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
<ParentTableRelation> |
<telerik:GridRelationFields DetailKeyField="TemplateId" MasterKeyField="SecurityGuardAvailabilityTemplateId" /> |
</ParentTableRelation> |
<DetailTables> |
<telerik:GridTableView Name="DaysTable" DataKeyNames="TemplateId" AutoGenerateColumns="false"> |
<Columns> |
<telerik:GridBoundColumn HeaderText="Day" UniqueName="DayName" DataField="DayName"> |
</telerik:GridBoundColumn> |
<telerik:GridDateTimeColumn HeaderText="Start Time" UniqueName="StartTime" DataField="StartTime" |
DataFormatString="{0:HH:mm}"> |
</telerik:GridDateTimeColumn> |
<telerik:GridDateTimeColumn HeaderText="End Time" UniqueName="EndTime" DataField="EndTime" |
DataFormatString="{0:HH:mm}"> |
</telerik:GridDateTimeColumn> |
</Columns> |
</telerik:GridTableView> |
</DetailTables> |
<ExpandCollapseColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
Resizable="False" Visible="False"> |
<HeaderStyle Width="20px" /> |
</ExpandCollapseColumn> |
<RowIndicatorColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" |
Visible="False"> |
<HeaderStyle Width="20px" /> |
</RowIndicatorColumn> |
</MasterTableView> |
</telerik:RadGrid> |
</div> |
</div> |
This is the code that populates the grids:
void RadGridGuardSummary_DetailTableDataBind(object source, GridDetailTableDataBindEventArgs e) |
{ |
if (e.DetailTableView.Name == "DaysTable") |
{ |
GridDataItem parentRow = e.DetailTableView.ParentItem; |
int securityGuardAvailabilitiesTemplateId = (int)parentRow.OwnerTableView.DataKeyValues[parentRow.ItemIndex]["SecurityGuardAvailabilityTemplateId"]; |
SomeDataRecord rec = SomeDatatable.GetRecord(securityGuardAvailabilitiesTemplateId.ToString(), false); |
e.DetailTableView.DataSource = DateTemplate.DayTemplate.GenerateDayTemplates(rec); |
} |
} |
public void RadGridSummary_NeedDataSource(object source, GridNeedDataSourceEventArgs e) |
{ |
DataTable data = this.GetData(); |
if (data != null) |
{ |
RadGridSummary.DataSource = data; |
} |
} |
This is the javascript that is called when the radwindow is closed:
function OnRadWindowClose() { |
var oWnd = GetRadWindow(); |
var parentWindow = oWnd.GetWindowManager().GetWindowByName("StandardWindow"); |
var contentFrame = parentWindow.GetContentFrame(); |
contentFrame.contentWindow.RefreshControls(); |
oWnd.Close(); |
} |
This is the RefreshControils method:
function RefreshControls() { |
var ajaxManager = $find("<%=RadAjaxManager1.ClientID%>"); |
if (ajaxManager != null) { |
ajaxManager.ajaxRequest("Refresh"); |
} |
return; |
} |
This is the AjaxUpdate method
void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) |
{ |
if (e.Argument == "Refresh") |
{ |
ReloadRecord(); |
} |
} |
Again, any help will be much appreciated. This one has me stumped