C# .NET - how can i make a column in a gridview invisible

Asked By grace paul on 23-Sep-08 06:09 AM

hi all,

how can i make a column in a gridview invisible after binding data to it. 


Make a column invisible in Gridview - Shailendrasinh Parmar replied to grace paul on 23-Sep-08 06:24 AM

You can make it invisible at the time of declaring it in aspx page like this

<asp:BoundField DataField="I_Empid" Visible="false"></asp:BoundField>

And you can make it invisible at Page_load event after binding it

gridview1.Columns[1].Visible = false;

You have to supply the index of the column to make it invisible.

Hope it helps.

can't get the value in the invisible column - grace paul replied to Shailendrasinh Parmar on 23-Sep-08 07:08 AM

hi ,

i tried it. but i can't get the inside the invisible column for further procesing. It returns a null value.i don't know why it happens so..maybe of it's invisibility.

Try out first with making it visible - Shailendrasinh Parmar replied to grace paul on 26-Sep-08 06:31 AM

No, thats is not possible. If the value is null, then only it will return null value. It will not return null because of its invisible status.

Please check the database table, it the value from it is coming or not...

You can first try with making the column visible and check whether you are getting value or not... i am sure that you won't get value
for that null column value.... Please check it.

Hope this helps.