Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > can not read the value of a tablecell in grideview

Reply
Thread Tools

can not read the value of a tablecell in grideview

 
 
ma
Guest
Posts: n/a
 
      09-19-2007
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[i].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


 
Reply With Quote
 
 
 
 
marss
Guest
Posts: n/a
 
      09-20-2007
On 20 , 00:22, "ma" <m...@nowhere.com> wrote:
>
> GridView_Enterprise_name.Rows[i].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[i].Cells[0].Text)

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
image field in a grideview ma ASP .Net 1 09-21-2007 12:22 PM
[Newbie Problem] BC30311: Value of "TableCell' cannot be convertedto 'Integer'. DC ASP .Net 3 08-08-2007 04:11 PM
grideview's OnRowUpdating event not fire =?Utf-8?B?d2Vp?= ASP .Net 1 04-03-2006 03:05 PM
Cutom TableCell Control : Custom Property Not Saving after Button Click ryan.d.rembaum@kp.org ASP .Net Building Controls 0 02-07-2006 08:37 PM
TableCell oTableCell = new TableCell(); noWrap? Brian K. Williams ASP .Net 2 04-30-2004 12:04 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57