Put the event handler in "selected" for the SQL DataSource. This event handler has an argument of type SqlDataSourceStatusEventArgs. There AffectedRows is the number of rows for the entire data set (and not just what is shown on the current page). So understand this and write on your label:
protected void SqlDataSource_Selected(object sender,SqlDataSourceStatusEventArgs e) { if (e.Exception != null) { // do something useful, then... e.ExceptionHandled = true; } else labelRowCount.Text = String.Format("{0} layers found", e.AffectedRows); }
philw source share