ListT - count records from ObjectDataSource


/ Published in: C#
Save to your folder(s)

Get number of record from ObjectDataSource if method returns ListT object.


Copy this code and paste it in your HTML
  1. // total label
  2. protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e)
  3. {
  4. if (e.Exception == null)
  5. {
  6. List<ActualGroup> DPcount = (List<ActualGroup>)e.ReturnValue;
  7. if (DPcount != null && DPcount.Count > 0)
  8. TotalLabel.Text = DPcount.Count.ToString();
  9. else
  10. TotalLabel.Text = "0";
  11. }
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.