Gridview interaction with Detailsview

N

nolan

I have an asp.net 2.0 page with a gridview and detailsview on the same
page set up in a master-details scenario. The gridview and detailsview
have separate SQL data sources. The user enters search criteria in a
text box and clicks a find button to initially populate the gridview
with items of interest. I have added a select button to my gridview
and when the user clicks the button the detailsview is populated
perfectly. However, I also want the detailsview to be automatically
populated with the first item in the gridview after the user clicks the
find button. I have programatically set the SelectedIndex for the
gridview to zero in the Selected event for the SQL datasource that
drives my gridview, but this doesn't update the detailsview until I
execute another postback. How can I make this work?

Thanks!

Jeff
 
G

Guest

set the SelectedIndex of your GridView in the DataBound Event of your GridView
It shoud work

Regards,
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 
N

nolan

Thansk for the reply. Your suggestion got me on the right track. I
also had to databind my DetailsView after settings the SelectedIndex in
the DataBound Event of the GridView to get this to work. I appreciate
the help!
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top