Needed: Index to a selected DataView row

Discussion in 'ASP .Net Datagrid Control' started by Paul, Dec 8, 2003.

  1. Paul

    Paul Guest

    Hi,
    I've got a DataGrid bound to a DataView that is sorted. ("Aha!", I hear
    you saying.)

    When I go to EditMode I get the right DataRow, but I get the wrong index
    from e.item.itemindex (of course.) Therefore, what I'm doing pretty
    much sucks as the Update updates the wrong record.

    How do I get the index of the selected item in a DataView? I get the
    results I want by hardcoding the index like this:

    DataRow1 = DataView1.Table.Rows(10)

    Thanks for your help, I've been searching in Google and MSDN for days
    with no luck. ~P



    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Paul, Dec 8, 2003
    #1
    1. Advertising

  2. Paul

    lostinet Guest

    just
    ((DataRowView)Container.Item.DataItem).Row

    "Paul" <> ????
    news:u$...
    > Hi,
    > I've got a DataGrid bound to a DataView that is sorted. ("Aha!", I hear
    > you saying.)
    >
    > When I go to EditMode I get the right DataRow, but I get the wrong index
    > from e.item.itemindex (of course.) Therefore, what I'm doing pretty
    > much sucks as the Update updates the wrong record.
    >
    > How do I get the index of the selected item in a DataView? I get the
    > results I want by hardcoding the index like this:
    >
    > DataRow1 = DataView1.Table.Rows(10)
    >
    > Thanks for your help, I've been searching in Google and MSDN for days
    > with no luck. ~P
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    lostinet, Dec 9, 2003
    #2
    1. Advertising

  3. Paul

    lostinet Guest

    also you can yse e.Item.DataSetIndex

    "Paul" <> ????
    news:u$...
    > Hi,
    > I've got a DataGrid bound to a DataView that is sorted. ("Aha!", I hear
    > you saying.)
    >
    > When I go to EditMode I get the right DataRow, but I get the wrong index
    > from e.item.itemindex (of course.) Therefore, what I'm doing pretty
    > much sucks as the Update updates the wrong record.
    >
    > How do I get the index of the selected item in a DataView? I get the
    > results I want by hardcoding the index like this:
    >
    > DataRow1 = DataView1.Table.Rows(10)
    >
    > Thanks for your help, I've been searching in Google and MSDN for days
    > with no luck. ~P
    >
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
     
    lostinet, Dec 9, 2003
    #3
  4. Paul

    Paul Guest

    Thanks, I'm working with it (having some problems) but the DataViewRow
    object looks very promising. ~P


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    Paul, Dec 9, 2003
    #4
    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. sri
    Replies:
    0
    Views:
    1,438
  2. CodeMonkey
    Replies:
    1
    Views:
    733
    joyal jhaveri
    Feb 4, 2011
  3. JohnE

    selected index row color

    JohnE, Mar 31, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    672
    JohnE
    Mar 31, 2010
  4. mldardy
    Replies:
    0
    Views:
    973
    mldardy
    Sep 28, 2010
  5. Tomasz Chmielewski

    sorting index-15, index-9, index-110 "the human way"?

    Tomasz Chmielewski, Mar 4, 2008, in forum: Perl Misc
    Replies:
    4
    Views:
    315
    Tomasz Chmielewski
    Mar 4, 2008
Loading...

Share This Page