I have an auto generated gridview that requires paging (and it must be auto generated since my original sql is dynamic). I need to hide a column, which is successfully done, but when I include AllowPaging="True" in the gridview, I receive the error:
Specified argument was out of the range of valid values. Parameter name: index
I know it's because the gridview is reading the first page returned and can't the second page, but how do I go about fixing this? The snippit was done with Northwind.
<html xmlns="http://www.w3.org/1999/xhtml" >
<form id="form1" runat="server">
<asp:GridView ID="GridView1" OnRowDataBound="GridView1_RowDataBound" runat="server"
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName] FROM [Alphabetical list of products] ORDER BY [ProductName]">
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
e.Row.Cells(1).Visible = False