HighTechTalks DotNet Forums  

Programmatically Access Data Behind SQLDataSource Controls

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Programmatically Access Data Behind SQLDataSource Controls in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
MitchW
 
Posts: n/a

Default Programmatically Access Data Behind SQLDataSource Controls - 12-06-2007 , 02:15 PM






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



Reply With Quote
  #2  
Old   
Mohamad Elarabi
 
Posts: n/a

Default RE: Programmatically Access Data Behind SQLDataSource Controls - 12-19-2007 , 01:39 AM






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:

Quote:
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



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.