Server Error in '/' Application.

There is no row at position 1.

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: There is no row at position 1.

Source Error:


Line 52:             For i As Integer = 1 To dt.Rows.Count
Line 53:                 If i > 3 Then Exit For
Line 54:                 CType(e.Row.FindControl("ListingImage" + i.ToString), Image).ImageUrl = dt.Rows(i).Item("FileFullUrl")
Line 55:                 CType(e.Row.FindControl("ListingImage" + i.ToString), Image).Visible = True
Line 56:             Next

Source File: c:\inetpub\wwwroot\TASRealty\TasRealty\App_Template\PrintListing.ascx.vb    Line: 54

Stack Trace:


[IndexOutOfRangeException: There is no row at position 1.]
   System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex) +2441533
   System.Data.DataRowCollection.get_Item(Int32 index) +19
   App_Template_PrintListing.GridViewResult_RowDataBound(Object sender, GridViewRowEventArgs e) in c:\inetpub\wwwroot\TASRealty\TasRealty\App_Template\PrintListing.ascx.vb:54
   System.Web.UI.WebControls.GridView.OnRowDataBound(GridViewRowEventArgs e) +137
   System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +262
   System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +5059
   System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +97
   System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +18
   System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +165
   App_Template_PrintListing.BindGrid(DataTable Datatbl) in c:\inetpub\wwwroot\TASRealty\TasRealty\App_Template\PrintListing.ascx.vb:80
   App_Template_PrintListing.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\TASRealty\TasRealty\App_Template\PrintListing.ascx.vb:42
   System.Web.UI.Control.OnLoad(EventArgs e) +106
   System.Web.UI.Control.LoadRecursive() +68
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Control.LoadRecursive() +162
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3785


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