I have a datagrid linked to a datatable which also outputs its data into textboxes, so if we pretend that I have the columns “Customer Name” and “Customer ID” and select the row that carries a customer named Jane Doe’s information, the corresponding textboxes would display Jane’s name and ID.
My problem comes when I sort by clicking the column headers on the datagrid. So say initially I have two rows that are displayed in the following order, the first containing “Jane Doe” and “123” as her ID, and the one below containing “Billy Bob” and “321” for his ID. If I click the “Customer Name” column header to order the data by the name in alphabetical order, the textbox output would act as though I had never reordered the datagrid rows at all. So after I sort so that Billy Bob’s information is shown above Jane’s in the datagrid, when I select Billy Bob’s row, I would still see Jane’s information in the name and ID textboxes. How should I go about fixing this? Thanks beforehand!