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

Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 22 Jan 2013, 10:05 AM
Hi,

I have a grid which is similar to the following demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarativerelations/defaultcs.aspx

In this grid I have Radbuttons which toggle on/off and adjust some figuress. On each toggle button I have a javascript function which calls a web service, which calls a store proc. After this I then attempt to rebind the grid on the client side like so
var masterTable = $find( result ).get_masterTableView();
            masterTable.rebind();

When I debug the project I get this error:
Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex

I'm also using the follow code to keep the nestedviews expanded, if I don't use it every change would cause the grid to collapse
void rg_ItemDataBound(object sender, GridItemEventArgs e)
    {
 
        //Expand all items using our custom storage
        string[] indexes = new string[this.ExpandedStates.Keys.Count];
        this.ExpandedStates.Keys.CopyTo(indexes, 0);
 
        ArrayList arr = new ArrayList(indexes);
        //Sort so we can guarantee that a parent item is expanded before any of
        //its children
        arr.Sort();
 
        foreach (string key in arr)
        {
            bool value = (bool)this.ExpandedStates[key];
            if (value)
            {
                rg.Items[key].Expanded = true;
                 
            }
        }
}
 
void rg_ItemCommand(object sender, GridCommandEventArgs e)
    {
         
        //if (e.CommandName == RadGrid.ExpandCollapseCommandName && !e.Item.Expanded)
        //{
        if (e.CommandName == RadGrid.ExpandCollapseCommandName)
        {
             
 
            this.ExpandedStates[e.Item.ItemIndexHierarchical] = true;
 
             
        }
    }
 
 private Hashtable _ordersExpandedState;
    private Hashtable ExpandedStates
    {
        get
        {
            if (this._ordersExpandedState == null)
            {
                _ordersExpandedState = this.Session["_ordersExpandedState"] as Hashtable;
                if (_ordersExpandedState == null)
                {
                    _ordersExpandedState = new Hashtable();
                    this.Session["_ordersExpandedState"] = _ordersExpandedState;
                }
            }
 
            return this._ordersExpandedState;
        }
    }


Thanks.




1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 25 Jan 2013, 09:17 AM
Hi,

Thank you for contacting us.

How you are binding RadGrid on the client or on the server side? The client-side TableView.Rebind() performs a postback and call Rebind method of RadGrid on the server. Could you share your full page source code along with the code-behind file content? Thus I will be able to examine your code and let you know what could possibly lead to this behavior.

I am looking forward your reply.

Regards,
Andrey
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.
Tags
Grid
Asked by
Karl
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or