473,378 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Gridview interaction with Detailsview

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

Aug 7 '06 #1
2 6222
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
"no***@easy.com" wrote:
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

Aug 7 '06 #2
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!
Muhammad Mosa wrote:
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
"no***@easy.com" wrote:
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
Aug 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jeffmagill | last post by:
Hi Everybody, I'm really hoping that someone can help me out because I have spent too much time on this project already! Basically, I have a DetailsView that handles all the Edits for a...
1
by: needin4mation | last post by:
Not sure what I'm doing wrong here. I have a gridview and a detailsview. The detailsview is set to insert by default. When I insert data the detailsview it works. The data goes in the database....
0
by: luvdairish | last post by:
Controls (in order on page) 1.)GridView - each row is a work order w/ a link for details in the last column 2.)DetailsView - when user clicks on link from above GridView, the details are shown...
0
by: luvdairish | last post by:
Controls (in order on page) 1.)GridView - each row is a work order w/ a link for details in the last column 2.)DetailsView - when user clicks on link from above GridView, the details are shown...
2
by: mike | last post by:
I have a page with a LoginView which contains a Gridview and a DetailsView, each in its own UpdatePanel The problem that I am experiencing is that when I select a record in the Gridview (using a...
1
by: needhelp1 | last post by:
I have gridview with a detailsview below. When I click on 'New' in brings up the DetailsView for inserting. When I click on 'Edit' in does not brink up the DetailsView. What am I doing wrong? I...
2
by: David Ching | last post by:
I am not getting any response to my previous question on reusing a DetailsView to insert and edit the selected row in a GridView. So I'll ask an even more basic question. Newbie alert! ;) When...
2
by: bogdan | last post by:
Hi, Can a single GridView be 'connected' to DetailsView that renders itself differently based on the currently selected row? I have a GridView with rows that could be displayed in the same way...
1
by: vineetbindal | last post by:
Hi all, I have a datagrid and detailsview. when a user selects a row in datagrid onSelectedIndexchanged is fired and Detailsview comes into picture. I want to display the data of the selected row...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.