| Author: Arunagiri Gunasekaran 05 Sep 2008 | Member Level: Gold | Rating: Points: 2 |
Hi, Try like this.
First move that data source to the dataview and use row filter
For example,
DataTable dt_Details = new DataTable(); dt_Details = //Fill the content DataView dv = new DataView(dt_Details); dv.RowFilter = "1 = 2";// this is avoid all the rows from the dataview
dgv.DataSource = dv; dgv.DataBind();
Here the dataview will not contain any records. Because '1=2' never satisfy to get the records. Hence the DataView contains only the structure but not the records. And so you will get the gridview with header alone.
All the Best :)
|
| Author: ramya 05 Sep 2008 | Member Level: Gold | Rating: Points: 2 |
if u have taken dataset and filled the gridview then try dis
ds.tables.clear(); (or) ds.rows.clear()
|
| Author: kalees 05 Sep 2008 | Member Level: Bronze | Rating: Points: 1 |
Hi Arunagiri Gunasekaran I dont have the dataset after binding to the gridview .. i make it as null ... when i click clear button i have to clear rows...
|
| Author: Divakar S 08 Sep 2008 | Member Level: Gold | Rating: Points: 3 |
Try this it will help u
dv.Table.Rows.Clear(); dataGridView1.DataSource = dv;
or
try this
select * from tablename where 1=0
|