can not read the value of a tablecell in grideview

Discussion in 'ASP .Net' started by ma, Sep 19, 2007.

  1. ma

    ma Guest

    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
     
    ma, Sep 19, 2007
    #1
    1. Advertising

  2. ma

    marss Guest

    On 20 , 00:22, "ma" <> wrote:
    >
    > 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
     
    marss, Sep 20, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian K. Williams

    TableCell oTableCell = new TableCell(); noWrap?

    Brian K. Williams, Apr 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,531
    Brian K. Williams
    Apr 30, 2004
  2. =?Utf-8?B?d2Vp?=

    grideview's OnRowUpdating event not fire

    =?Utf-8?B?d2Vp?=, Apr 1, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    4,530
    =?Utf-8?B?d2Vp?=
    Apr 3, 2006
  3. DC
    Replies:
    3
    Views:
    1,095
  4. ma

    image field in a grideview

    ma, Sep 21, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    311
    Michael Nemtsev, MVP
    Sep 21, 2007
  5. Replies:
    0
    Views:
    137
Loading...

Share This Page