locked
Fill textboxes with selected datagrid item RRS feed

  • Question

  • Hello,

    I  have no idea how to code to fill textboxes with the selected datagrid row, that is why I came here to post this topic.



    I will include a screenshot for more clarity:
    http://img152.imageshack.us/img152/2061/datagridmk6.jpg

    The Button that says " Ophalen " is to search records in the database and fill the datagrid.

    p.s.

    my idea was the following:

    fill "tb_Voorletters.Text" with the value of "Voorletter"(database collumn) where the DataKeyNames is RelatieID


    but, how do I get this idea into code?

    so, i want the selected information from the datagrid filled into the textboxes

    Thank you for your time
    • Edited by junkano Monday, June 2, 2008 7:52 AM removed [img] tags
    • Moved by Peter Ritchie Tuesday, June 3, 2008 7:26 PM off-topic
    Monday, June 2, 2008 7:29 AM

Answers

  • i found out the solution,

    just insert a DetailsList and enable editing, also set AutogenerateEditButton to true on the DetailsList' properties.

    furthermore a appoint a datasource to the detailslist
    • Marked as answer by junkano Tuesday, June 3, 2008 12:25 PM
    • Marked as answer by junkano Tuesday, June 3, 2008 12:25 PM
    • Marked as answer by junkano Tuesday, June 3, 2008 12:25 PM
    Tuesday, June 3, 2008 12:25 PM
  • For questions and discussions relating to DataGrid, please see http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=7&SiteID=1
    http://www.peterRitchie.com/blog
    • Marked as answer by Peter Ritchie Tuesday, June 3, 2008 7:26 PM
    Tuesday, June 3, 2008 7:26 PM

All replies

  • I don't have the complete code in mind, but there should be some way to the following:

    Subscribe to the datagrid's Select event. The method handling the event should receive some sort of RowEventArgs (or something along the lines) from that you can then access the datagrid and read the cells' contents and fill your textboxes from there...

    Hope this helps, but it's been a while since I've worked with datagrids and stuff :D
    Monday, June 2, 2008 1:38 PM
  • I don't understand
    Tuesday, June 3, 2008 8:24 AM
  • i found out the solution,

    just insert a DetailsList and enable editing, also set AutogenerateEditButton to true on the DetailsList' properties.

    furthermore a appoint a datasource to the detailslist
    • Marked as answer by junkano Tuesday, June 3, 2008 12:25 PM
    • Marked as answer by junkano Tuesday, June 3, 2008 12:25 PM
    • Marked as answer by junkano Tuesday, June 3, 2008 12:25 PM
    Tuesday, June 3, 2008 12:25 PM
  • For questions and discussions relating to DataGrid, please see http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=7&SiteID=1
    http://www.peterRitchie.com/blog
    • Marked as answer by Peter Ritchie Tuesday, June 3, 2008 7:26 PM
    Tuesday, June 3, 2008 7:26 PM