Specified argument was out of the range of valid values
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Specified argument was out of the range of valid values

  1. #1
    Join Date
    Apr 2009
    Posts
    1

    Specified argument was out of the range of valid values

    I have one dropdownbox(ddlCountryTax) containing allcountries,If i select USA it will display grid displaying Tax information related to USA.If i edit information in grid and if we change country USA to UK in dropdown box in the ddlCountryTax(not the dropdownbox coming in the edit window of grid,,no problem for that) it displaying error like

    Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

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

    Source Error:

    Line 86: } Line 87: Line 88: if( rgStateTax.EditItems.Count > 0 ) Line 89: { Line 90: foreach( GridDataItem item in rgStateTax.Items )

    Source File: c:\Projects\ACS\Aivea.Acs.Administration\UserControls\TaxManager.ascx.cs Line: 88

    Stack Trace:

    [ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: ItemHierarchicalIndex] Telerik.WebControls.GridItemCollection.get_Item(String hierarchicalIndex) +323 Telerik.WebControls.GridDataItemCollection.get_Item(String hierarchicalIndex) +37 Telerik.WebControls.RadGrid.get_EditItems() +215 Aivea.Acs.Administration.TaxManager.rgStateTax_PreRender(Object sender, EventArgs e) in c:\Projects\ACS\Aivea.Acs.Administration\UserControls\TaxManager.ascx.cs:88 System.Web.UI.Control.OnPreRender(EventArgs e) +8682870 System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +31 Telerik.RadGridUtils.RadControl.OnPreRender(EventArgs e) +36 Telerik.RadGridUtils.RadAJAXControl.OnPreRender(EventArgs e) +37 Telerik.WebControls.RadGrid.OnPreRender(EventArgs e) +40 System.Web.UI.Control.PreRenderRecursiveInternal() +80 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

    this is code dropdown event
    Code:
                   protected void ddlCountryTax_SelectedIndexChanged( object sender, EventArgs e )
            {
                long locationId = ddlCountryTax.SelectedItem.Value.AsLong();
    
                ContentAdministrationServiceClient client = null;
                List<DCTaxRate> taxRate = null;
                try
                {
                    client = new ContentAdministrationServiceClient();
                    taxRate = client.GetTaxRatesByCountryIdAndLocationTypeName( locationId, "State" );
                    client.Close();
                }
                catch( FaultException )
                {
                    AbortClient( client );
                }
    
                rgStateTax.DataSource = taxRate;
                rgStateTax.Rebind();
    
            }
    this is radgrid
    Code:
    protected void rgStateTax_EditCommand( object sender, EventArgs e )
            {
                BindStateTax();
            }
    Code:
     private void BindStateTax()
            {
                long locationId = ddlCountryTax.SelectedItem.Value.AsLong();
    
                List<DCTaxRate> taxRate = null;
                ContentAdministrationServiceClient client = null;
                try
                {
                    client = new ContentAdministrationServiceClient();
                    taxRate = client.GetTaxRatesByCountryId( locationId );
                    client.Close();
                }
                catch( FaultException )
                {
                    AbortClient( client );
                }
    
                rgStateTax.DataSource = taxRate;
                rgStateTax.Rebind();
            }
    
    
    
    
    
       if( ddlState.SelectedIndex > 0 )
                {
                    txtState.Text = ddlState.SelectedItem.Text;
                }
                taxRate.StateName = txtState.Text;

  2. #2
    Join Date
    Aug 2000
    Location
    Essex, Uk
    Posts
    1,214

    Re: Specified argument was out of the range of valid values

    If you step the code, what line throws the error
    If you find my answers helpful, dont forget to rate me

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center