View Full Version : Setting a details view
05-03-2012, 05:57 PM
Hey guys, I have a gridview where I allow the user to select one row, then that populates a details view. From here, I would like to populate other detailviews based on a uniqueID that is contained in the first detailsview selected in the gridview. How do I do that?
For example a uniqueID is clicked on in the gridview, then that unique ID is used to populate a row in the first details view, then that same unique ID must be taken from the details view, and a sql query performed on this same table to find a parent uniqueID and detail information. How do I do this?
05-03-2012, 07:23 PM
to do this via postback (much easier) you would do it all in the code behind.... clicking on the uniqueID would have an associated event handler that would do two things- one is populate a detailsview (or create a new one) and the other would be to fire a SQL query.
post-back with what you need help/clarification/guidance on,
good luck :)
05-04-2012, 02:37 PM
Okay heres what I've got so far, under App-Data, I've got an access database called AncestorsDotNet.accdb. Below is an event handler. I want to access this database and get the gridview1 uniqueid and look up another uniqueid via a fatherid. from there I want to set another form field or details view control. How do I do this?
Protected Sub View1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
' create a new SqlConnection object with the appropriate connection string
Dim sqlConn As New SqlConnection() 'OleDbConnection i
' open the connection
'do some operations here...
'close the connection
Dim command As New SqlCommand("SELECT * from TblDotNetAncestorsTree", sqlConn)
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.