can not read the value of a tablecell in grideview

  • Thread starter Thread starter ma
  • Start date Start date
M

ma

Hello,

I have a gridview that is bound to a dataset. One col of this grid is
bound to the primary key of the dataset which its data format is integer.

I want to read the value of this key and I am using code similar to the
following:



GridView_Enterprise_name.Rows.Cells[0].text

The above code is working if the data format of the field in the dataset is
string but it doesn't work if it is an integer. What should I do to get the
value of this field?



Regards
 
GridView_Enterprise_name.Rows.Cells[0].text

The above code is working if the data format of the field in the dataset is
string but it doesn't work if it is an integer. What should I do to get the
value of this field?


Perhaps, you forgot to cast string value to integer.
int key = int.Parse(GridView_Enterprise_name.Rows.Cells[0].Text)

Regards,
Mykola
http://marss.co.ua
 
Back
Top