We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


WebControl.GridView bug?

RobAinscough asked
Medium Priority
Last Modified: 2012-06-27
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.
Watch Question

do it like this

        Dim iSelectedRow As Integer = 2
        gv.SelectedIndex = iSelectedRow
        Label1.Text =  gv.SelectedRow.Cells(6).Text


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).

Hi well i had the same problem and to work around it I made the field a  TemplateField

Hope helps
PAQed with points refunded (125)

Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.