Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting a details view

    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?

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,924
    Thanks
    46
    Thanked 203 Times in 202 Posts
    this can get complex pedning what/how you want to do it- if you want to do it all client side (ie no postback) you will need to populate 'something' and then handle unhiding various aspects using javascript...

    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.

    You have all the information- you almost answered your own question- I think the only place it gets to be more complex is if you want it to happen all client end via javascript-

    post-back with what you need help/clarification/guidance on,
    good luck

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    MsgBox("test")

    ' create a new SqlConnection object with the appropriate connection string
    Dim sqlConn As New SqlConnection() 'OleDbConnection i
    ' open the connection
    sqlConn.Open()
    'do some operations here...
    'close the connection

    Dim command As New SqlCommand("SELECT * from TblDotNetAncestorsTree", sqlConn)

    sqlConn.Close()

    End Sub


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •