I get the below error
I have a field that I bound with the gridview. when the value for the row is the same I just only display one row and ignore the other until the row value is different.
I have a field that I bound with the gridview. when the value for the row is the same I just only display one row and ignore the other until the row value is different.
Code:
<asp:BoundField DataField="lettingdate" HeaderText="Letting Date" >
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:BoundField>
<asp:TemplateField HeaderText="View Abstract (PDF)">
<ItemTemplate>
<asp:HyperLink ID="abstractPDF" runat="server" Target="_blank" Text='<%# Eval("contractid","Abstract (PDF)") %>' > </asp:HyperLink>
</ItemTemplate>
<HeaderStyle Wrap="False" />
<ItemStyle Wrap="False" />
</asp:TemplateField>
Partial Class abstractMenu
Inherits System.Web.UI.Page
Private previousCat As String = ""
Private firstRow As Integer = -1
Dim dsabstract As New DataSet
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 55:
Line 56: If previousCat = drv("lettingdate").ToString() Then
Line 57: If gvabstract.Rows(firstRow).Cells(0).RowSpan = 0 Then
Line 58: gvabstract.Rows(firstRow).Cells(0).RowSpan = 2
Line 59: Else
[code]