Dynamically Hiding Columns of Data Grid !

Posted by .Netlearner under ASP.NET on 12/28/2012 | Points: 10 | Views : 1655 | Status : [Member] | Replies : 5
Hello All,

i Have a data grid in which i want the values of the first column must be accessed but it ust not be visible.

I tried the Following code,

DG3.Columns[1].Visible = false;


but its not working,still column 1 is visible.

How this can be acheived . Can anyone please guide me.




Responses

Posted by: Pavanandey on: 12/28/2012 [Member] Bronze | Points: 25

Up
0
Down
<asp:GridView runat="server" ID="gb">
<Columns>
<asp:BoundField DataField="" HeaderText="" Visible="false" />
</Columns>
</asp:GridView>

Thanks
Pavan Kumar
Mark Answer if this fits the need

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/28/2012 [Member] Bronze | Points: 25

Up
0
Down
gb.Columns[0].Visible = false;

Thanks
Pavan Kumar
Mark Answer if this fits the need

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pavanandey on: 12/28/2012 [Member] Bronze | Points: 25

Up
0
Down
MARK ANSWER IF THIS HELPS YOU

Thanks
Pavan Kumar
Mark Answer if this fits the need

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 12/28/2012 [Member] Starter | Points: 25

Up
0
Down
its a template column and i have already applied the above code still it is not working.Please Guide Me?

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shipramaurya on: 12/28/2012 [Member] Starter | Points: 25

Up
0
Down
If u want to know the column number , you can go to edit Columns under Smart tag of GridView..

Suppose You have Fields in the following order

Bound Field
Template Field
Bound Field
Bound Field
Bound Field

To make template field Visible write

Gridview1.Columns(1).Visible = false;

@Shipra - S.M. Techie

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response