用DataGrid实现分页,在使用存储过程返回数据集时出现问题?
我用DataGrid实现分页,用执行存储过程得到的结果作为其数据原时出现错误,请各位帮忙看看!
Dim sProcName As String = "过程_分类查询产品信息"
Dim sqlComm As SqlCommand = New SqlCommand(sProcName, myConnection)
sqlComm.CommandType = CommandType.StoredProcedure
sqlComm.Parameters.Add("@PID", pid)
myConnection.open()
MyDataGrid.DataSource = sqlComm.ExecuteReader(CommandBehavior.CloseConnection)
MyDataGrid.DataBind()
myConnection.Close()
出现的错误提示
当 AllowPaging 设置为真并且选定的数据源不实现 ICollection 时,AllowCustomPaging 必须为真,并且 ID 为 MyDataGrid 的 DataGrid 必须设置 VirtualItemCount。
然后我把AllowCustomPaging设为真后,她就不能分页了,不知怎么回事?