Programmatically Access Data Behind SQLDataSource Controls

Discussion in 'ASP .Net Web Controls' started by MitchW, Dec 6, 2007.

  1. MitchW

    MitchW Guest

    Hello,

    I have a GridView that is bound to a SQLDataSource. I have enable item
    selection on this GridView. I have a button on this .aspx page which does
    some work on a different table that what the gridview (SQLDataSource) is
    bound to. In order for the button to do its work I need the identity value of
    the currently selected item in the GridView or from the SQLDataSource for the
    OnClick of the button. How can I get that?

    thanks,
    mitch
     
    MitchW, Dec 6, 2007
    #1
    1. Advertising

  2. In your onClick event for the button, reference the GridView's SelectedValue
    property to get the ID of the selected row. This would be something like this:

    MyGridView.SelectedValue

    Hope that works.

    --
    Mohamad Elarabi
    Lead Developer. MCTS, MCPD.


    "MitchW" wrote:

    > Hello,
    >
    > I have a GridView that is bound to a SQLDataSource. I have enable item
    > selection on this GridView. I have a button on this .aspx page which does
    > some work on a different table that what the gridview (SQLDataSource) is
    > bound to. In order for the button to do its work I need the identity value of
    > the currently selected item in the GridView or from the SQLDataSource for the
    > OnClick of the button. How can I get that?
    >
    > thanks,
    > mitch
    >
    >
     
    Mohamad Elarabi, Dec 19, 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. Guest
    Replies:
    2
    Views:
    6,959
    Guest
    Jun 28, 2005
  2. Replies:
    1
    Views:
    7,496
    Markus
    Aug 25, 2005
  3. Siva
    Replies:
    1
    Views:
    465
    =?Utf-8?B?UmljaA==?=
    Apr 17, 2006
  4. Vili
    Replies:
    1
    Views:
    468
  5. =?Utf-8?B?cm9kY2hhcg==?=

    Programmatically using SqlDataSource

    =?Utf-8?B?cm9kY2hhcg==?=, Jun 11, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    436
    Alexey Smirnov
    Jun 12, 2007
Loading...

Share This Page