I don't Ishai. Very frustrating for such a seemingly simple request.

I've tried it all over the place with the same result. All the examples I found 
seemed to prefer the Selected event which should be right.

I wound up using this result as the total and added a grid row count in the row 
databound method. It only returns the displayed results, so isn't perfect if 
paging is enabled. But it'll do for now.

Regards,

Paul

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Ishai Sagi
Sent: Thursday, 31 July 2014 5:11 PM
To: ozMOSS
Subject: RE: Unable to get filtered row count from ObjectDataSource

Move the code to a different event? For example, the prerender event?

From: ozmoss-boun...@ozmoss.com<mailto:ozmoss-boun...@ozmoss.com> 
[mailto:ozmoss-boun...@ozmoss.com] On Behalf Of Paul Noone
Sent: Thursday, 31 July 2014 1:29 PM
To: ozMOSS
Subject: Unable to get filtered row count from ObjectDataSource

Hi all,

I have a web part which displays user profiles for a site. The profiles are 
rendered using an SPGridView with paging and filtering enabled.

The grid is connected to an ObjectDataSource which uses the SelectMethod to 
pull results from a DataTable.

I want to get the result count after any filtering occurs. But this always 
returns the TOTAL! :{

protected void ds_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
       if (e.Exception == null)
       {
       resultCount.Text = ((DataTable)e.ReturnValue).Rows.Count.ToString();
       }
}

Regards,

Paul

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system.
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information.

________________________________

This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal

________________________________

The content of this email is confidential to the intended recipient at the 
email address to which it has been addressed. It may not be disclosed to, or 
used by, anyone other than this addressee, nor may it be copied in any way. If 
received in error, please contact the author and then delete the message from 
your system. 
Please note that neither Keller Australia nor the sender accepts any 
responsibility for viruses and it is your responsibility to scan the email and 
attachments (if any).
Visit http://www.keller.com.au/ for more information. 

--------------------------------------------------------------------------------
This e-mail message has been scanned for Viruses and Content and cleared by 
MailMarshal 
--------------------------------------------------------------------------------
_______________________________________________
Sponsored by Infotext - Amazing Search for Microsoft SharePoint - 
http://www.infotext.com/
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to