Link to home
Create AccountLog in
Avatar of lorgnettesolutions
lorgnettesolutions

asked on

Hide autogenerated columns in gridview after gridview rowcommand button click

I have a gridview in which I have 4 defined columns with buttons in them and 3 autogenerated columns. When I click the button in gv.column(1) I would like to make gv.column(5).visible = false

however when I do this in the gv_rowcommand private sub, I get the following error:

Index out of range. Must be non-negative and less than the size of the collection.

Can anyone help me hide the fifth column successfully?
Avatar of guru_sami
guru_sami
Flag of United States of America image

The columns are zero based indexed.
So for 5th column you should do: gv.columns(4).Visible=false
Avatar of Nasir Razzaq
Does it work if you hide column in page load after binding the grid?
ASKER CERTIFIED SOLUTION
Avatar of lorgnettesolutions
lorgnettesolutions

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of lorgnettesolutions
lorgnettesolutions

ASKER

I did a work around to resolve my problem. Thanks