开发者

ASP.NET Databind GridView to Datasource comes up empty

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.MaximumRowsParameterNam开发者_如何学Ce = "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()


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

ObjectDataSource Paging -> no data displayed in GridView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜