473,856 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6253
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
1876
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 GridView - each row has an edit button and clicking on this should trigger that record to be loaded into the DetailsView for editing. The problem is that the record never gets loaded into the DetailsView. Instead, the DetailsView always and only...
1
5956
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. The gridview on the page, however, never refreshes to show the new row. The sql for the gridview defaults to a LIKE % and when the page first loads I can see all the records. If after I try an edit a gridview record and delete or cancel, then...
0
2132
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 3.)GridView - nested in the footer of the above DetailsView. each row is a person assigned to that work order 4.)DetailsView - only visible when the user clicks "add tech" in the DetailsView from #2 (above). allows technician to be added to work...
0
1601
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 3.)GridView - nested in the footer of the above DetailsView. each row is a person assigned to that work order 4.)DetailsView - only visible when the user clicks "add tech" in the DetailsView from #2 (above). allows technician to be added to work...
2
11640
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 SelectButton), the selected record is shown in the DetailsView, which is correct - however, when I choose "Update" on the DetailsView I am presented with the EditItemTemplate which contains the first record in the DetailsDataSource. The code...
1
5033
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 totally at a loss, please help. I don't know if I need to something to grdUserProfile_RowEditing. Thank you! This is some of my code behind: protected void grdUserProfile_RowEditing(object sender, GridViewEditEventArgs e) { } protected void...
2
4389
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 the user clicks the Edit link in a GridView, is it common to use a DetailsView to edit that row instead of putting the GridView into Edit mode and editing the row in place? I would assume so, because the GridView does not typically have columns...
2
2521
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 in the view (like a report) but when a user wants to edit/insert items I'd like to show a different layout and different controls based on the selected item type. For example, for some items I'd like to provide text boxes and for others I'd like...
1
7795
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 in detailsview. can some1 please tell me how to do that. Regards, vineet
0
9920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
10699
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10790
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10390
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5762
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5960
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4580
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4176
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.