У меня есть один dropdownbox (ddlCountryTax), содержащий allcountries. Если я выберу США, он отобразит сетку, отображающую налоговую информацию, связанную с США. Если я отредактирую информацию в сетке и если мы сменим страну США в Великобритании в раскрывающемся списке в ddlCountryTax (не идет в выпадающем DropDownBox'е окне редактирования сетки ,, никаких проблем для этого) это отображение ошибки какУказанный аргумент был вне диапазона допустимых значений
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
Источник ошибки:
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
трассировки стека:
[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
это код выпадающий событие
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();
}
это 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();
}
Это предварительно делают событие:
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;
}
}
}
}
используйте предварительный просмотр и обратитесь к http: // stackoverflow/editing-help, чтобы убедиться, что ваше форматирование верное! –
К сожалению, я думаю, что Джефф имел в виду http://stackoverflow.com/editing-help –
Мы должны положить что-нибудь в команду Edit – peter