How to show Header In GridView When Dataset Empty

Sunil Soni
Posted by Sunil Soni under ASP.NET category on | Points: 40 | Views : 2342
If ds.Tables(0).Rows.Count > 0 Then
GdvAdd.DataSource = ds.Tables("AddTbl")
GdvAdd.DataBind()
Else
ds.Tables(0).Rows.Add(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
GdvAdd.DataSource = ds.Tables("AddTbl")
GdvAdd.DataBind()
GdvAdd.Rows(0).Visible = False
End If

Comments or Responses

Posted by: T.saravanan on: 12/26/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi Sunil Soni,

Kindly post your code inside the code tag.

Can you explain uses of this line? --> ds.Tables(0).Rows.Add(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)

I think its not the perfect code.
Posted by: Pervej on: 12/28/2011 Level:Starter | Status: [Member] | Points: 10
if(ds.table[0].rows.count>0)
{
}
else
{
ds.Tables(0).Rows.Add(0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}

regards
bharti
www.interviewqsn.com www.getproductprice.com

Login to post response