How do I make a C# DataView column invisible? I thought it would be similar to ReadOnly but the following doesn't work because there is no "visible" property.
foreach(DataColumn c in myDataView.Table.Columns)
{
if(visiblecolumns.Contains(c.ColumnName))
{
c.Visible = true;
}
else
{
c.Visible = false;
}
}
See: http://msdn.microsoft.com/en-us/library/bb383893%28v=vs.90%29.aspx
customersDataGridView.Columns[0].Visible = false;
UPDATED
SqlDataAdapter da = new SqlDataAdapter("SELECT Title,FirstName,LastName FROM
Employees",conn);
da.Fill(ds_orig);
ds_copy = ds_orig.Copy();
dt = ds_copy.Tables[0];
dt.Columns.Remove("Title");
dv = new DataView(dt);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.