1
如何获取Data Annotation'Browsable'设置为False的列的值?如何获取Data Annotation'Browsable'设置为False的列的值
[Browsable(false)]
public int IDArtikli { get; set; }
我使用的DataGridView,我试图让selectedRows ID值,但因为我不显示在DataGridView的ID列无法通过简单的代码获得它:
int id = -1;
int index = this.dataGridView.SelectedRows[0].Index;
Int32.TryParse(dataGridView["IDArtikl", index].Value.ToString(), out id);
尝试Visible属性设置列假的,而不是浏览的注解。我以这种方式隐藏了列,但仍然能够获得它的价值。 – Wheels73
:/如果我真的必须。 – ChenChi