Server Error in '/' Application.

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

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: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source Error:


Line 22:     Protected Sub dvNews_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles dvNews.DataBound
Line 23:         If dvNews.CurrentMode = DetailsViewMode.ReadOnly Then
Line 24:             Dim tbNews As HtmlTable = DirectCast(dvNews.Rows(0).FindControl("tbNews"), HtmlTable)
Line 25:             If dvNews.DataItem("Picture").ToString = "" Then
Line 26:                 tbNews.Rows(0).Cells(0).Visible = False

Source File: E:\Inetpub\vhosts\thaiesco.org\httpdocs\thai\newsdetail.aspx.vb    Line: 24

Stack Trace:


[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
   System.Collections.ArrayList.get_Item(Int32 index) +14814396
   System.Web.UI.WebControls.DetailsViewRowCollection.get_Item(Int32 index) +19
   thai_newsdetail.dvNews_DataBound(Object sender, EventArgs e) in E:\Inetpub\vhosts\thaiesco.org\httpdocs\thai\newsdetail.aspx.vb:24
   System.Web.UI.WebControls.BaseDataBoundControl.OnDataBound(EventArgs e) +122
   thai_newsdetail.ShowData(Int32 ID) in E:\Inetpub\vhosts\thaiesco.org\httpdocs\thai\newsdetail.aspx.vb:19
   thai_newsdetail.Page_Load(Object sender, EventArgs e) in E:\Inetpub\vhosts\thaiesco.org\httpdocs\thai\newsdetail.aspx.vb:9
   System.Web.UI.Control.OnLoad(EventArgs e) +106
   System.Web.UI.Control.LoadRecursive() +68
   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