0

I have a GridView on an ASP.NET page that I'm trying to bind to an object data source that I've set up to map to a vb object I made which accesses the DB. When I run the page, though, the gridview comes up empty. The ObjectDataSource is definitely returning data. The paging parameters are making it to the underlying object. All the way until I get to the DataBind() call everything seems fine. But the grid comes up empty. Funny thing is, if I use the method that returns all records in the DB, the grid populates just fine. Only when I try to implement custom paging does display no records. I've tried using the wizards, I've tried diagrammatically setting it up and run time. No matter what I do I can't get paged data to display in the grid.

oDatasource = New ObjectDataSource()
oDatasource.EnablePaging = True
oDatasource.TypeName = "tblMessage"
oDatasource.SelectMethod = "GetTblMessageSubset"
oDatasource.SelectCountMethod = "SelectCount"
oDatasource.SelectParameters.Clear()
oDatasource.SelectParameters.Add("strCompanyID", strCompanyID)
oDatasource.SelectParameters.Add("strEmployeeID", strEmployeeID)
oDatasource.StartRowIndexParameterName = "startRowIndex"
oDatasource.MaximumRowsParameterName = "maximumRows"

GridView1.AllowPaging = True
GridView1.PageIndex = 0
GridView1.PageSize = 10
GridView1.PagerSettings.Visible = True
GridView1.EmptyDataText = "No Data........"
GridView1.PagerSettings.Mode = PagerButtons.Numeric
GridView1.AutoGenerateColumns = True
GridView1.DataSource = oDatasource
GridView1.DataBind()
John
  • 2,653
  • 4
  • 36
  • 57
  • can you check if "SelectCount" method is returning an Integer as mentioned here? http://stackoverflow.com/questions/6774154/objectdatasource-paging-no-data-displayed-in-gridview – Akhil Aug 04 '11 at 17:00

1 Answers1

1

can you check if SelectCount method is returning an Integer as mentioned here?

ObjectDataSource Paging -> no data displayed in GridView

Community
  • 1
  • 1
Akhil
  • 7,570
  • 1
  • 24
  • 23