WebControl.GridView bug?

I'm trying to retrieve a value I placed in a grid view column that is set to NOT visible:

gv_Units is the GridView control

Dim gvRow As GridViewRow
For Each gvRow In gv_Units.Rows

    Dim someValue as string = gvRow.Cells(6).Text

Next gvRow

If column 6 is not visible SomeValue = ""
If column 6 is visible SomeValue = "myvalue"

Is this a known bug with GridView?  Please tell me this is NOT a "design feature".  Any workarounds?

Thanks, Rob.
RobAinscoughAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

iboutchkineCommented:
do it like this

        Dim iSelectedRow As Integer = 2
        gv.SelectedIndex = iSelectedRow
        Label1.Text =  gv.SelectedRow.Cells(6).Text
0
RobAinscoughAuthor Commented:
Being a selected row is not relevant.

I discovered the solution, setup a CSS style (i.e. NoVisibleText) that is "display:none" -- assign the CSSClass for each of the column properties (i.e. ControlStyle.CSSClass = NoVisibleText, ItemStyle.CSSClass = NoVisibleText, HeaderStyle.CSSClass = NoVisibleText, FooterStyle.CSSClass = NoVisibleText) -- Keep the Column Visible property = True (this must be true or the cell value can never be retreived).

Rob.
0
aponcealbuerneCommented:
Hi well i had the same problem and to work around it I made the field a  TemplateField


Hope helps
0
GranModCommented:
PAQed with points refunded (125)

GranMod
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.