Rauf
Rauf

Reputation: 12842

asp.net gridview

I want to hide a column of GridView based on a condition. How can I access the column in C# code?

 if() // condition
 {
     // Disable code here. ?????
 } 

Thanks in advance.

Upvotes: 0

Views: 1118

Answers (2)

harshagile
harshagile

Reputation: 346

Yes Akhtar You are correct.

grdUsers.Columns[0].Visible = false;

This code remove first column of gridview on displaying side.

Upvotes: 1

Muhammad Akhtar
Muhammad Akhtar

Reputation: 52241

Very simple man..

Grid.Columns[columnIndex].Visible = false;

Upvotes: 2

Related Questions