View Single Post
Old 05-09-2017, 01:16 PM   #1
Donnieclark
Banned
 
Join Date: May 2017
Location: UK
Posts: 2
Default Get record count from a Gridviews sqldatasource after filtering

28 Points
998 Posts
Get record count from a Gridviews sqldatasource after filtering
Dec 23, 2008 04:25 PM|LINK

I'm trying to get a row count from a Gridviews sqldatasource after filtering, but the count returns the value before filtering.

This filtering works but if I use e.AffectedRows shown below even after filtering it still shows the total rows returned before filtering.

FilterExpression="LastName Like '%{0}%' AND FirstName Like '%{1}%'"
<FilterParameters>
<asp:ControlParameter ControlID="LastNameTextBox" DefaultValue="%" Name="LastName" PropertyName="Text" />
<asp:ControlParameter ControlID="FirstNameTextBox" DefaultValue="%" Name="FirstName" PropertyName="Text" />
</FilterParameters>

To get the TOTAL records returned this works, but it is NOT the filtered row count
Protected Sub SqlDataSource1_Selected(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEvent Args) Handles sdsViewCMEs.Selected
lblWarning.Text = e.AffectedRows & " rows returned"
End Sub

Any idea

Last edited by edbr; 05-09-2017 at 03:33 PM..
Donnieclark is offline   Reply With Quote