Error converting from String to Int in TextBox

0

I have a GridView and inside this I have the function RowUpdating and when I want to change the data, I throw a conversion error.

  

Input string was not in a correct format.

In the way I want to convert the TextBox is the following:

int id = Convert.ToInt32(((TextBox)row.FindControl("txtid")).Text);

A Tip that gives me is the following:

  

When converting to string to DateTime, parse the string to taje the date berfore putting each Variable into the DateTime object.

but obviously I do not want to convert it to DateTime since it is a Id .

    
asked by Cesar Gutierrez Davalos 23.05.2017 в 16:03
source

1 answer

1

In the gridview you can use the DataKeyNames to define the columns you want to access that are hidden and so you can get the value. you can consult more information of the DataKeyNames --- > here

    
answered by 23.05.2017 / 17:28
source