sameer
sameer

Reputation: 1

how to hide GridView column when data is accessed dynamically in gridview

hii

I have 2 gridviews they are bind by sqldatasource ,it contains Id , Name and Price

i dont want to show ID coloumn when page is loaded.How to hide it?

Upvotes: 0

Views: 3442

Answers (3)

Carmelo La Monica
Carmelo La Monica

Reputation: 765

You can also hide the column from the code where you feel like.

this.DataGridView1.Columns["ID coloumn"].Visible = false;

Regards.

Upvotes: 0

Mayur Borad
Mayur Borad

Reputation: 1295

 protected void gvDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            e.Row.Cells[1].Visible = false;
        }

Upvotes: 1

bkaid
bkaid

Reputation: 52093

Add Visible="false" to the column declaration, or in code.

Upvotes: 1

Related Questions