Get GridView's datasource after Post Back

Discussion in 'ASP .Net' started by phil.a.jenkins, Sep 13, 2006.

  1. Hello

    I have a GridView which is bound to a standard DataSet on Page_Load.


    Grid.DataSource = dataSet;

    I have added columns manually in the aspx source, and one of them is a
    ButtonField, which is hooked up to a _RowCommand event handler.

    What I need to do is to be able to get values out of the original
    dataset when the command button is clicked, note they are not displayed
    in the gridview itself. Is there a way of doing this?

    Apologies if this makes no sense, ASP.NET is still foreign to me :)
    phil.a.jenkins, Sep 13, 2006
    1. Advertisements

  2. Thanks Eliyahu for your response

    The way the web app has been developed means that we can't use session
    variables (any session information is stored in the DB) so any
    Context.Session stuff is out of bounds.

    I basically need to be able to set the CommandArgument of a LinkButton
    in the GridView to have a value which is an ID extracted from the
    DataSet, instead of the default, which is the grid's row ID. Is there
    an event I can use to handle this?

    Many thanks

    phil.a.jenkins, Sep 13, 2006
    1. Advertisements

  3. You can persist the dataset in a session variable.
    Eliyahu Goldin, Sep 13, 2006
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.