New Posts New Posts RSS Feed: Total RowCount from GridView using AspDataSource
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Total RowCount from GridView using AspDataSource

 Post Reply Post Reply
Author
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Topic: Total RowCount from GridView using AspDataSource
    Posted: 06-Jun-2008 at 8:45am
Why don't you just execute the same code again.  Since I suspect that the entities are already cached, it shouldn't take very long.
Back to Top
kmg-pm View Drop Down
Newbie
Newbie


Joined: 04-Jun-2008
Location: United States
Posts: 8
Post Options Post Options   Quote kmg-pm Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jun-2008 at 12:30pm
I had tried what you suggested previously, but had some trouble.
 
I have the SelectEntities method in my custom EntityAdapterManager class.   I had created a public property containing the count, and I was setting it in SelectEntities.  Then I tried using the GetAdapterManager method to access this property, but it didn't seem tied to the same instance of my AdapterManager as the EntityQuery was run in.  How could I reference that particular instance?
 
Thanks,
Kevin
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jun-2008 at 12:06pm
I wouldn't worry about the cost of getting all of the entities of a given entity type because these entities will likely already be in the cache so performance should be very good.  If you want to, you could also store the total entity count somewhere as a byproduct of performing SelectEntities.
Back to Top
kmg-pm View Drop Down
Newbie
Newbie


Joined: 04-Jun-2008
Location: United States
Posts: 8
Post Options Post Options   Quote kmg-pm Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jun-2008 at 9:30am
Hello,
 
I have an ASP.NET standard GridView bound to an AspDataSource.  I want to retrieve the total row count from the data source.  This is not available from the grid, since I have paging enabled.  Also, I would rather not have to execute a second query just to get the count.
 
I thought about handling the AspDataSource.OnDataBinding event, but none of the event handlers seem to be firing for AspDataSource. 
 
Can I get access to the data directly somehow?  When inspecting, I noticed an AspDataSourceView object.  What is this, and can I get to it?
 
Additionally, if you have any better information and/or samples of using DevForce in ASP.NET apps, that would be great.  The one sample using AspDataSource is pretty bare.
 
Thanks in advance,
-Kevin
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down