Server Error in '/' Application.

Index was outside the bounds of the array.

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.IndexOutOfRangeException: Index was outside the bounds of the array.

Source Error:


Line 175:        dTable.DefaultView.Sort = "displayRank";
Line 176:
Line 177:        foreach (DataRow dRow in dTable.DefaultView.ToTable().Rows)
Line 178:        {        
Line 179:            if (int.Parse(dRow["currencyID"].ToString()) == currentCurrencyID)

Source File: c:\sajtovi\Clarion\controls_new\DropList.ascx.cs    Line: 177

Stack Trace:


[IndexOutOfRangeException: Index was outside the bounds of the array.]
   System.Data.DataView.CopyTo(DataRowView[] array, Int32 index) +180
   System.Data.DataView.GetEnumerator() +53
   System.Data.DataView.ToTable(String tableName, Boolean distinct, String[] columnNames) +644
   DropList.GetCurrencies() in c:\sajtovi\Clarion\controls_new\DropList.ascx.cs:177
   DropList.Page_PreRender(Object sender, EventArgs e) in c:\sajtovi\Clarion\controls_new\DropList.ascx.cs:25
   System.Web.UI.Control.OnPreRender(EventArgs e) +11906436
   System.Web.UI.Control.PreRenderRecursiveInternal() +162
   System.Web.UI.Control.PreRenderRecursiveInternal() +256
   System.Web.UI.Control.PreRenderRecursiveInternal() +256
   System.Web.UI.Control.PreRenderRecursiveInternal() +256
   System.Web.UI.Control.PreRenderRecursiveInternal() +256
   System.Web.UI.Control.PreRenderRecursiveInternal() +256
   System.Web.UI.Control.PreRenderRecursiveInternal() +256
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6875


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.4087.0