2

I have a vb.net application in which a grid view is there with a hidden field. I want to get the value of that hidden cell

Code behind statusGrdvw.Rows(assign).Cells(5).Text

  • Depends on wich framework version you use, but i suggest you to use GridView.DataKey instead of this trick, it will help also to reduce page size and overall complexity. – Giulio Caccin Aug 08 '15 at 11:47

3 Answers3

0

Well you can add this style in the html

<style>
.hidden {display:none;}
        #exportother {
            position: relative;
            top: 13px;
            left: -840px;
        }
    </style>

Then on the field you want to hide

ItemStyle-CssClass="hidden"
HeaderStyle-CssClass="hidden"

The field will be hidden but will be accessible from code behind.

Nikolay
  • 329
  • 1
  • 7
0

You didn't provide much to go on but what you need to do is get it by its control index. So basically if you have 2 controls in one column you have a control at index 0 and index 1. Something like this (you'll have to look up the exact syntax):

((HiddenInput)statusGrdvw.Rows(assign).Cells(5).Controls[0]).Value
Stephen Brickner
  • 2,584
  • 1
  • 11
  • 19
0

Try this one to fetch the value in hidden field :

Dim hidden2 As String  = CType(statusGrdvw.SelectedRow.Cells(5).FindControl("HiddenfieldID"), HiddenField).Value;
Rojalin Sahoo
  • 1,025
  • 1
  • 7
  • 18