Programmatically Access Data Behind SQLDataSource Controls

M

MitchW

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
 
M

Mohamad Elarabi

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top