1
@Karthi and @Vivek
Thanks for you help
I got solution, i have tried this in another way like below
DataView view = new DataView();
view.Table = ds.Tables[0];
view.RowFilter = "status='New'";
dt = view.ToTable();
dt.Columns.Remove("status");
gvPubPlanCreated.DataSource = dt;
gvPubPlanCreated.DataBind();
this help to hide a status column from Gridview after applying filter on dataSet
Regards
Sameer Shaikh
1
@sameer,
Try this,
DataTable dtTable = ds.Table[0].DefaultView.ToTable(true, "EmpName","Address");
Grid.DataSource = dtTable;
0
@Jyoti
Thanks for your help, but i have did this and i have data in DataSet.
I was trying to apply filter on DS and save that data into specific GV and that column, i mean filter column like i wrote below
DataTable dt=new DataTable();
DataView view = new DataView();
view.Table = ds.Tables[0];
view.RowFilter = "status='New'";
dt = view.ToTable();
dt.Columns.Remove("status");
gvPubPlanCreated.DataSource = dt;
gvPubPlanCreated.DataBind();
Regards
Sameer Shaikh
0
@Sameer,
i didn't try that in dataview. but it should work in the DataTable and Dataset. Try this surely you will get output.
0
@Vivek
I am getting data from Db and i have set AutoGeneratedColumn=true
Show data into Grid dynamically.
Please let me know How can i fix this problem.
Regards
Sameer Shaikh
0
@Karthi
Sorry for late reply
I was busy on other stuff.
As per you have mentioned with dataset, Can i do same thing with DataView.
Regards
Sameer
0
Have a look into the below links.
https://stackoverflow.com/questions/6358799/asp-net-programatically-bind-dataset-to-gridview
https://stackoverflow.com/questions/10941104/c-sharp-and-asp-net-getting-a-specific-column-from-a-dataset-in-gridview
-1
public static DataTable GetGridDatasource(string database, string ordnum)
{
using (OleDbConnection con = new OleDbConnection("PROVIDER=Microsoft.ACE.OLEDB.12.0;Data Source=" + database))
{
con.Open();
OleDbCommand cmd = con.CreateCommand();
cmd.CommandText = "select * from [Order] where order_num=[OrderNumber]";
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("OrderNumber", ordnum);
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
}