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

System.ArgumentOutOfRangeException

4 Answers 369 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 07 Dec 2012, 08:01 PM
We have a RadToolTip containing a RadScheduler and two RadGrids. We want to keep these objects in sync, so we've employed a RadAjaxManager. Unfortunately, the events that we want to sync after are fired from controls within the NestedViews of the RadGrids. When EnableAjax is set to false, the following error is thrown:

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: ItemHierarchicalIndex]
   Telerik.Web.UI.GridItemCollection.get_Item(String hierarchicalIndex) +153
   Telerik.Web.UI.GridDataItemCollection.get_Item(String hierarchicalIndex) +50
   Telerik.Web.UI.RadGrid.LoadClientState(Dictionary`2 clientState) +7307
   Telerik.Web.UI.RadCompositeDataBoundControl.LoadPostData(String postDataKey, NameValueCollection postCollection) +305
   Telerik.Web.UI.RadCompositeDataBoundControl.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +73
   System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +1068
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2773

What can we do? Thanks.

4 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 12 Dec 2012, 12:29 PM
Hi,

Please refer to the following forum thread which elaborates on this matter and see if it helps to avoid this error:
http://www.telerik.com/community/forums/aspnet-ajax/grid/hierarchyloadmode-causes-javascript-error-when-set-to-client.aspx

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Matthew
Top achievements
Rank 1
answered on 13 Dec 2012, 04:17 PM
I have fiddled with the settings found on thread and in a few other places. Changing the HierarchyLoadMode to be anything other than Client does indeed remove the error, but then my NestedViews don't expand and the rows in the master table start using the following row as their NestedView which creates all sorts of confusion when expanding and collapsing. Let me include on the RadGrids so you can see where I'm at.

<telerik:RadGrid ID="rgMyAppointments" runat="server" OnNeedDataSource="rgMyAppointments_NeedDataSource" OnColumnCreated="ColumnCreated" OnItemCommand="rgMyAppointments_ItemCommand" OnItemDataBound="rgMyAppointments_ItemDataBound" OnPreRender="rgAppointments_PreRender" AutoGenerateColumns="false" ShowHeader="false" ShowFooter="false" Width="100%">
    <ClientSettings ClientEvents-OnRowClick="RowClick" />
    <MasterTableView HierarchyLoadMode="ServerBind" NoMasterRecordsText="No Appointments">
        <Columns>
            <telerik:GridBoundColumn DataField="Ticket.Client.ClientFullName" UniqueName="Name" />
            <telerik:GridDateTimeColumn DataField="AppointmentStartTime" DataFormatString="{0:MMM d, yyyy @ h:mm}" UniqueName="Start" />
            <telerik:GridTemplateColumn UniqueName="Location">
                <ItemTemplate>
                    <%# Eval("AppointmentRoom").ToString() + ' ' + Eval("Building.BuildingName") %>
                </ItemTemplate>
            </telerik:GridTemplateColumn>
        </Columns>
        <NestedViewSettings DataSourceID="ldsAppointments">
            <ParentTableRelation>
                <telerik:GridRelationFields MasterKeyField="AppointmentID" DetailKeyField="AppointmentID" />
            </ParentTableRelation>
        </NestedViewSettings>
        <NestedViewTemplate>
            <asp:Table runat="server" Width="100%">
                <asp:TableRow>
                    <asp:TableCell RowSpan="2" Width="50px">
                        <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" PersistDataIfNotVisible="true" ResizeMode="Fit" Height="70px" Width="50px" ImageUrl='<%# String.Format("{0}?ID={1}&Type={2}&Thumb=1", ResolveUrl("~/Private/Handlers/PhotoHandler.ashx"), Convert.ToInt32(Eval("Ticket.TicketClientID")), "client") %>'/>
                    </asp:TableCell>
                    <asp:TableCell ColumnSpan="2" VerticalAlign="Top">
                        <asp:Label runat="server" Text='<%# Eval("AppointmentNotes") %>' OnPreRender="AppointmentNotes_PreRender" />
                    </asp:TableCell>
                </asp:TableRow>
                <asp:TableRow VerticalAlign="Bottom">
                    <asp:TableCell HorizontalAlign="Left">
                        <asp:HiddenField ID="hfAppointment" runat="server" Value='<%# Eval("AppointmentID") %>' />
                        <asp:HiddenField ID="hfTicket" runat="server" Value='<%# Eval("AppointmentTicketID") %>' />
                        <telerik:RadComboBox ID="rcbStatus" runat="server" AutoPostBack="true" ZIndex="100001" DataTextField="AppointmentStatusName" DataValueField="AppointmentStatusID" OnClientSelectedIndexChanging="rcbStatus_Disable" OnSelectedIndexChanged="rcbStatus_SelectedIndexChanged" />
                    </asp:TableCell>
                    <asp:TableCell HorizontalAlign="Right">
                        <telerik:RadButton ID="rbStatus" runat="server" AutoPostBack="true" Text="Update Status" OnCommand="Command" CommandName="Status" CommandArgument='<%# Eval("AppointmentID") %>' />
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

function RowClick(sender, e) {
    var rows = e.get_tableView().get_dataItems();
    for (i = 0; i < rows.length; i++){
        rows[i].set_expanded(rows[i] == e.get_gridDataItem() && !rows[i].get_expanded());
    }
}
 
function rcbStatus_Disable(sender, e) { sender.disable(); }

<asp:LinqDataSource ID="ldsAppointments" runat="server" ContextTypeName="SciNET.BusinessObjects.SciNETDataContext" TableName="Appointments" />

I'm attaching before and after photos so you can see what's happening. Only row clicks occur between the two photos.
0
Pavlina
Telerik team
answered on 15 Dec 2012, 02:03 PM
Hello,

Did you try setting HierarchyLoadMode to ServerOnDemand and what is the result?

All the best,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Matthew
Top achievements
Rank 1
answered on 03 Jan 2013, 04:52 PM
The answer is in my previous post. We ended up switching over to panel bars.
Tags
Ajax
Asked by
Matthew
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Matthew
Top achievements
Rank 1
Share this question
or