我想隐藏datagridview中的id列。我试图通过更改存储过程/ SQL查询,它的工作原理,但我无法获得该条目的ID由于某种原因,我也需要每个条目的ID,但不希望显示在前端。从datagridview中隐藏id列但需要使用它
有什么建议吗?
private void category_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'shopBillingDataSet.category' table. You can move, or remove it, as needed.
this.categoryTableAdapter.Fill(this.shopBillingDataSet.category);
button3.Enabled = false;
button1.Enabled = true;
}
private void button1_Click(object sender, EventArgs e)
{
BSL.category obj = new BSL.category();
obj.catName = textBox1.Text;
obj.catDesc = textBox2.Text;
DAL.categoryDAL obj1 = new categoryDAL();
obj1.addCategory(obj);
this.categoryTableAdapter.Fill(this.shopBillingDataSet.category);
textBox1.Text = "";
textBox2.Text = "";
MessageBox.Show("New Category entered");
category_Load(sender,e);
}
不改变存储的过程..只是设置可见属性上在DataGridView ID列=假,你需要设置的属性在你的DataGridView设计这不是困难..如果你不确定有很多的例子加上DataGridView列隐藏在互联网上的文档.. – MethodMan
感谢兄弟我搜查,但有很长的细节没有身体告诉简单的方法,因为你只是引导我,非常感谢非常感谢。所以如果使用'datagridview datasource = datatable',那么这就是简单绑定的解决方案,而不是如何完成 –