First you need to wrap your code in a Label
or Literal
control so that you can reference it properly. What's happening is that there's no way for the system to keep track of it, because there's no control associated with the text. It's the control's responsibility to add its contents to viewstate.
You need to use gridView.FindControl("controlName"); to get the control in the row. From there you can get at its properties including Text
.
You can also get at the DataItem property of the Row in question and cast it to the appropriate type and extract the information directly.