2011-03-19 49 views

回答

0

所以你正在寻找特定页面上的总行数?

如果是这样,您不应该试图从GridView中找到该信息,而应该查看您绑定GridView的底层DataSource

例如,

List<SomeObjects> lst = GetYourData(); 
yourGrid.DataSource = lst; 
yourGrid.DataBind(); 

// if you want to get the count for a specific page 
int currentPage = 2; 
int countForPage2 = (lst.Count > currentPage * totalItemsPerPage)) ? 
    totalItemsPerPage : lst.Count - ((currentPage - 1) * totalItemsPerPage);