开发者

How do I make a C# DataView column invisible?

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜