J'ai une liste déroulante (ddlCountryTax) contenant tous les pays, Si je sélectionne USA, elle affichera la grille affichant les informations fiscales relatives aux USA. Si je modifie les informations dans la grille et si nous changeons de pays USA au Royaume-Uni dans la boîte déroulante dans le ddlCountryTax (pas dropdownbox venir dans la fenêtre d'édition de la grille ,, aucun problème pour cela), il affiche une erreur commeL'argument spécifié était hors de la plage des valeurs valides
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 erreur:
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.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
c'est l'événement menu déroulant 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();
}
c'est RadGrid
protected void rgStateTax_EditCommand(object sender, EventArgs e)
{
BindStateTax();
}
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();
}
C'est l'événement pré-rendu:
protected void rgStateTax_PreRender(object sender, EventArgs e)
{
if(rgStateTax.MasterTableView.IsItemInserted)
{
foreach(GridItem item in rgStateTax.Items)
{
item.Visible = false;
}
}
if(rgStateTax.EditItems.Count > 0)
{
foreach(GridDataItem item in rgStateTax.Items)
{
if(item != rgStateTax.EditItems[0])
{
item.Visible = false;
}
}
}
}
veuillez utiliser preview et référez-vous à http: // stackoverflow/editing-help pour vous assurer que votre formatage est correct! –
Oups - Je pense que Jeff voulait dire http://stackoverflow.com/editing-help –
Nous devons mettre n'importe quoi dans la commande d'édition – peter