Hi,all
How to Hide automatically generated column in GridView in C#? any property is there?plz tell me.
Thanx in Advance
himanshu
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Master BillaPosted Sep 1, 2009, 10:54 AM
You can do this way also
private void Form1_Load(object sender, EventArgs e)
{
dataGridView1.Columns[0].Width= 0;
}
thank you
Kirtan PatelPosted Sep 1, 2009, 8:44 AM
Here is What you want .
dont forget to mark "Do you like answer" please it will give me some credits :)
private void Form1_Load(object sender, EventArgs e)
{
//Code For Filling the DataGridView from database
// Code For Hiding Columns Youwant
//Suppose you want to hide column 2 and 3
dataGridView1.Columns[1].Visible = false;
dataGridView1.Columns[2].Visible = false ;
}
Niradhip ChakrabortyPosted Sep 1, 2009, 6:12 AM
{
if (e.Row.Cells.Count >= 1)
e.Row.Cells[1].Visible = false;
}
Assuming you want to hide the second column in your automatically generated GridView.