Getting value inserted in asp.Net text field

1

I have GridView and in one of the columns I have a textbox field where I enter values in them.

I would like to know how I get the values typed from the fields, I've already done the following:

for (int i = 0; i <= gvTeste.Rows.Count - 1; i++)
{
    string variavel = gvTeste.Rows[i].Cells[8].Text
}

But it is always returning empty, as if nothing is filled in cell 8 which is where I entered the value.

    
asked by anonymous 12.04.2018 / 14:00

1 answer

1

I believe you will have to use a DataBound event to retrieve the values, similar to this.

protected void gvTeste_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
      var variavel = (TextBox)e.Item.FindControl("seu campo txt");
}

With this you will get all the values of the field entered in the FindControl.

    
12.04.2018 / 14:27