/ Published in: C#
Get number of records in DataTable when calling a method with ObjectDataSource.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
protected void ObjectDataSource1_Selected(object sender, ObjectDataSourceStatusEventArgs e) { if (e.Exception == null) { DataTable dt = (DataTable)e.ReturnValue; if (dt != null) TotalLabel.Text = dt.Rows.Count.ToString(); else TotalLabel.Text = "0"; } }