how can I check if my SqlDataSource1 select method returns 0 count of nodes (rows) after :
SqlDataSource1.DataBind();
how can I check if my SqlDataSource1 select method returns 0 count of nodes (rows) after :
SqlDataSource1.DataBind();
If I understand your comment, what you want to do is check the gridview after you databind for any rows, if there is not any it will just return zero (0)
GridView1.DataBind();
int i = 0;
i = GridView1.RowCount;
EDIT after comments: OK, now I understand.here is how you can check the datasource for the number of records affected, you have to use the SqlDataSource1_Selected event
protected void SqlDataSource1_Selected(object sender, SqlDataSourceStatusEventArgs e)
{
if (e.AffectedRows > 0) //this is where you check the number of rows!
{
//do something
}
else
{
//something else...
}
}
The selected event fires right after the select operation completes