none
Getting DetailsView to show selected GridView item in .aspx page RRS feed

  • Question

  • Hi, I am having trouble getting an idea of how to approach this issue.  A brief breakdown of how my code is setup. 

    The aspx page I am working on is a simple query page into a database.  When a user enters search text into a ASP:textbox, and they select to submit, it launches a sub function which creates a SQLconnection to the database and then binds it to a gridview.  This is done in the script section for the page.  The 2nd part which I am getting stuck on is how do I get to read which item a user selects, and subsequently displays more detailed information pertaining to that record.  I am not using the SQLDATASOURCE commands, so I have no clue how I pass the appropriate information from the gridview over to the detailsview in order for correct information to be displayed. 

    Any help would be greatly appreciated.  Thanks.

    • Moved by Martin Xie - MSFT Friday, August 21, 2009 6:40 AM Redirect to ASP.NET forums for better support. (From:Visual Basic General)
    Friday, August 14, 2009 5:56 PM

Answers

  • Hey Malange,

    I got it figured out. 

    Basically, what I ended up doing was create a whole new sub-routine, that based on when a user clicks the SELECT button on the gridview it makes a ONSELECTEDINDEXCHANGE to the sub-routine, which runs the correct SQL command to get all of the data desired in the detailsview.  The way by which I passed the selected record was by using the DATAKEYS value in the gridview.  Works great.

    Thanks.
    Friday, August 21, 2009 11:49 AM

All replies

  • Hi, I am having trouble getting an idea of how to approach this issue.  A brief breakdown of how my code is setup. 

    The aspx page I am working on is a simple query page into a database.  When a user enters search text into a ASP:textbox, and they select to submit, it launches a sub function which creates a SQLconnection to the database and then binds it to a gridview.  This is done in the script section for the page.  The 2nd part which I am getting stuck on is how do I get to read which item a user selects, and subsequently displays more detailed information pertaining to that record.  I am not using the SQLDATASOURCE commands, so I have no clue how I pass the appropriate information from the gridview over to the detailsview in order for correct information to be displayed. 

    Any help would be greatly appreciated.  Thanks.


    Can you post the code here...to see what is wrong with it...
    DeepF1
    Friday, August 14, 2009 7:20 PM
  • Hey Malange,

    I got it figured out. 

    Basically, what I ended up doing was create a whole new sub-routine, that based on when a user clicks the SELECT button on the gridview it makes a ONSELECTEDINDEXCHANGE to the sub-routine, which runs the correct SQL command to get all of the data desired in the detailsview.  The way by which I passed the selected record was by using the DATAKEYS value in the gridview.  Works great.

    Thanks.
    Friday, August 21, 2009 11:49 AM