Posted By

leonbda on 01/21/09


Tagged

count datatable ObjectDataSource


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Count records in Datatable with ObjectDataSource


 / Published in: C#
 

Get number of records in DataTable when calling a method with ObjectDataSource.

  1. protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e)
  2. {
  3. if (e.Exception == null)
  4. {
  5. DataTable dt = (DataTable)e.ReturnValue;
  6. if (dt != null)
  7. TotalLabel.Text = dt.Rows.Count.ToString();
  8. else
  9. TotalLabel.Text = "0";
  10. }
  11. }

Report this snippet  

You need to login to post a comment.