can not read the value of a tablecell in grideview

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
 
M

marss

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top