ObjectDataSource Call MaxRowCount multiple times
If you have an ObjectDataSource and are using it to do the Page Count - it
calls a method that querys the database to get this number.
The problem is that everytime the user presses the page control at the
bottom of the grid to get the next page or another page, it calls this
<asp:ObjectDataSource ID="ObjectDataSource1" EnablePaging="true"
In this case it calls SelectCountMethod (GetRowCount) each time a user wants
a new page.
In my DAO object, my method looks like:
public int GetRowCount()
// int id;
SqlConnection con = new
SqlCommand com = new SqlCommand("GetDetailsRowCount", con);
com.CommandType = CommandType.StoredProcedure;
SqlDataReader dr = com.ExecuteReader();
int count = 0;
if (dr["NumberOfRows"] != null)
int.TryParse(dr["NumberOfRows"].ToString(), out count);
The problem is that this method is called from the ObjectDataSource each
time a user wants a new page which means a new trip to the database to get
the number I already got the first time around.
You can't seem to store the number in the object as the DAO object is
created each time you get the next page.
Is there a way to tell the ODS to use the same number it had the first time
|All times are GMT. The time now is 10:28 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.