DataGrid Woes

Discussion in 'ASP .Net Datagrid Control' started by Freddy, Jul 29, 2005.

  1. Freddy

    Freddy Guest

    I have a datagrid that I created and fill a dataset using a stored proc.
    and bind it. The first column( a linkbutton button column) in the DG
    contains a number, the second a name. When the user presses the button I
    need the number displayed on the link. The number is a field from the
    database. I got the code to trap the button press to work, but I cant get
    the number displayed.. (vb.net)

    Sub Gridclick( byval sender as object, byval e as datagridcommandeventargs)
    handles datagrid1.ItemCommand

    I've tried different variations of casting such as
    CType(e.Item.Cells(0).Controls(0), ButtonColumn) or LinkButton and other
    variations
    I also tried to use the e.item.cell(0).text and other variations of the
    e.item....
    I CAN READ the NAME part of the row with e.item.cells(1).text.
    WHAT GIVES..?
    I tried many different commands till I am frustrated.
    A code sample to read the first col link would be great.
    Thank You
    F
     
    Freddy, Jul 29, 2005
    #1
    1. Advertising

  2. Freddy

    Elton Wang Guest

    Hi Freddy,

    If the linkbutton button is in the first column, following code should work:

    Dim linkNumber As String = CType(e.Item.Cells(0).Controls(0),
    LinkButton).Text

    HTH

    "Freddy" <> wrote in message
    news:uqqjv#...
    > I have a datagrid that I created and fill a dataset using a stored proc.
    > and bind it. The first column( a linkbutton button column) in the DG
    > contains a number, the second a name. When the user presses the button I
    > need the number displayed on the link. The number is a field from the
    > database. I got the code to trap the button press to work, but I cant get
    > the number displayed.. (vb.net)
    >
    > Sub Gridclick( byval sender as object, byval e as

    datagridcommandeventargs)
    > handles datagrid1.ItemCommand
    >
    > I've tried different variations of casting such as
    > CType(e.Item.Cells(0).Controls(0), ButtonColumn) or LinkButton and other
    > variations
    > I also tried to use the e.item.cell(0).text and other variations of the
    > e.item....
    > I CAN READ the NAME part of the row with e.item.cells(1).text.
    > WHAT GIVES..?
    > I tried many different commands till I am frustrated.
    > A code sample to read the first col link would be great.
    > Thank You
    > F
    >
    >
    >
     
    Elton Wang, Jul 31, 2005
    #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. Kevin Vaughn

    Date Woes

    Kevin Vaughn, Jul 3, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    613
    David Waz
    Jul 3, 2003
  2. =?Utf-8?B?Sm9obiBIb3BwZXI=?=

    datagrid woes

    =?Utf-8?B?Sm9obiBIb3BwZXI=?=, Oct 3, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    415
    =?Utf-8?B?Sm9obiBIb3BwZXI=?=
    Oct 3, 2005
  3. Dhruba Bandopadhyay

    HELP: ASP.NET & XML DataGrid.... woes :S

    Dhruba Bandopadhyay, Mar 30, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    333
    Dhruba Bandopadhyay
    Mar 30, 2006
  4. dhruba.bandopadhyay

    HELP: ASP.NET & XML DataGrid.... woes :S

    dhruba.bandopadhyay, Mar 30, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    346
    dhruba.bandopadhyay
    Mar 30, 2006
  5. Andreas Klemt
    Replies:
    0
    Views:
    320
    Andreas Klemt
    Oct 8, 2003
Loading...

Share This Page