datagrid generated with rows from a view and its dillema

Discussion in 'ASP .Net Datagrid Control' started by David, Jul 3, 2003.

  1. David

    David Guest

    Hello,

    I have a datagrid populated with rows from a view. Because they are from a
    view, the rows are not actual database records, and therefore lack unique
    identifiers.

    So I have a command button for each row. When the button is pressed, I want
    to go to another page with all the information in that selected row.
    Normally I would do this (if the rows are actual records, that is)

    //take the datakey value
    string selected_id = dgMyDataGrid.DataKeys[e.Item.ItemIndex]

    //and do this before tranfering to another page.
    Context.Items.Add("uniquekey", selected_id);
    Then on the second page, I would take the selected_id and retreive the
    record from the database (I've always wondered if that trip to the database
    server would be necessary).

    But I can't even do this with rows from a view because there is no unique
    identifier. But I still want to take the row from the view and give it to
    the destination page.
     
    David, Jul 3, 2003
    #1
    1. Advertising

  2. Is there ANY thing or combination of fields you can use to uniquely identify
    that row?

    Datagrid Girl
    http://www.datagridgirl.com

    "David" <> wrote in message
    news:MyJMa.67696$...
    > Hello,
    >
    > I have a datagrid populated with rows from a view. Because they are from

    a
    > view, the rows are not actual database records, and therefore lack unique
    > identifiers.
    >
    > So I have a command button for each row. When the button is pressed, I

    want
    > to go to another page with all the information in that selected row.
    > Normally I would do this (if the rows are actual records, that is)
    >
    > //take the datakey value
    > string selected_id = dgMyDataGrid.DataKeys[e.Item.ItemIndex]
    >
    > //and do this before tranfering to another page.
    > Context.Items.Add("uniquekey", selected_id);
    > Then on the second page, I would take the selected_id and retreive the
    > record from the database (I've always wondered if that trip to the

    database
    > server would be necessary).
    >
    > But I can't even do this with rows from a view because there is no unique
    > identifier. But I still want to take the row from the view and give it to
    > the destination page.
    >
    >
     
    Datagrid Girl [MVP], Jul 4, 2003
    #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. David C

    Dillema: Editable GridView rows

    David C, Mar 20, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    326
    David C
    Mar 20, 2009
  2. Joe Van Dyk

    Packaging dillema

    Joe Van Dyk, Jun 23, 2005, in forum: Ruby
    Replies:
    8
    Views:
    133
    James Britt
    Jun 23, 2005
  3. thunk
    Replies:
    1
    Views:
    315
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    488
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    626
    thunk
    Apr 3, 2010
Loading...

Share This Page