Please replace the following code
da.Fill(ds);
DataTable dt = new DataTable();
if (dt.Rows.Count==0)
{
grdpending.DataSource = ds;
grdpending.DataBind();
}
else
{
grdpending.EmptyDataText = "No Data Found";
}
with
da.Fill(ds);
grdpending.EmptyDataText = "No Data Found";
grdpending.DataSource = null;
if (ds.Tables.Count>0)
{
if(ds.Tables[0].Rows.Count>0)
{
grdpending.DataSource = ds;
}
}
grdpending.DataBind();
I hope this will help you :)