I have the following gridview
<asp:GridView ID="importErrors" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource_Errors" OnRowDataBound="gvErrors_CrossSale" PersistedSelection="True"
AllowSorting="True" PageSize="3" AllowPaging="True">
<Columns>
<asp:BoundField DataField="ccId" HeaderText="ccId" ReadOnly="True"
SortExpression="ccId" >
<HeaderStyle ForeColor="#FF0066" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="custId" HeaderText=" ID " ReadOnly="True"
SortExpression="custId" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="idCampaign" HeaderText="Кампања ID" ReadOnly="True"
SortExpression="idCampaign" >
<HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:CheckBoxField DataField="Kontaktiran" HeaderText="Контактиран"
ReadOnly="True" SortExpression="Kontaktiran" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:CheckBoxField>
<asp:BoundField DataField="datumKontaktiran" HeaderText="Датум"
ReadOnly="True" SortExpression="datumKontaktiran"
DataFormatString="{0:d}" />
<asp:BoundField DataField="idKomentar" HeaderText="Коментар ID" ReadOnly="True"
SortExpression="idKomentar" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="Zabeleska" HeaderText="Забелешка" ReadOnly="True"
SortExpression="Zabeleska" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
<asp:BoundField DataField="custFilijala" HeaderText="Филијала"
ReadOnly="True" SortExpression="custFilijala" >
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</asp:BoundField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource_Errors" runat="server"
ConnectionString="<%$ ConnectionStrings:CrossSaleConnectionString %>"
SelectCommand="sp_ImportErrors" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
which is page enabled and the following event handler Protected Sub gvErrors_CrossSale(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.Cells(1).Text.Equals("-1") Then
e.Row.Cells(1).ForeColor = Drawing.Color.Red
End If
If e.Row.Cells(4).Text.Equals("01/01/1900") Then
e.Row.Cells(4).ForeColor = Drawing.Color.Red
End If
Dim csObj As New CrossSaleMethods()
If e.Row.Cells(5).Text.Equals("-1") Or csObj.ExistsInKomentari(e.Row.Cells(5).Text) Then
e.Row.Cells(5).ForeColor = Drawing.Color.Red
End If
End Sub
The fail is following: "Specified argument was out of the range of valid values. Parameter name: index" when i set the gridview as pagged enabled, otherwise i don't have this problem?
Any suggestions?