Raconteur Posted November 6, 2003 Posted November 6, 2003 Hi all, I have been poking around in MS .NET help and on the web, and am not finding a definitive answer to this, so I thought I throw it up here where I know I will get the info I need... Is it true that if I want to have a DataGrid with a "Select" column that populates a set of text boxes to display the details of a record I have to handle the select event (either ItemCommand or SelectedItemChanged) and parse out the cells of the DataGridItem into their respective fields by hand? Or is there some way of binding the text box to a specific cell of the selected DataGridItem? It seems that the latter should be an existing solution for the control, but I cannot seem to find anything on it. I did find a MSDN article and it appeared that their sample code did it all by hand, which kinda sucks... Any input appreciated! Cheers, Chris Quote
Moderators Robby Posted November 6, 2003 Moderators Posted November 6, 2003 You can do both, though I haven't attempted the latter on a web based textbox. Quote Visit...Bassic Software
Raconteur Posted November 6, 2003 Author Posted November 6, 2003 Thanks for the response, Robby. Is there a "recommended" way of doing this? You said I can do both, but how do I bind a text field to a cell of the selected row of the DG? The data bindings property builder only shows me data sets... Quote
Moderators Robby Posted November 6, 2003 Moderators Posted November 6, 2003 I wouldn't bind the textboxes for something like this, get the PK id from the selected row in the DG, then use the related dataview or datatable to get the detail values into them. (the textboxes) Quote Visit...Bassic Software
Raconteur Posted November 6, 2003 Author Posted November 6, 2003 Thanks again. Here is what I ended up doing. When I select a row in the main DG, I stuff that row into a hidden data set. I have all of my controls (most anyway) bound to the hidden data set. Seems to work well so far. I won't be able to use the built-in INSERT and UPDATE stuff in the hidden data set though because I have a State field that stores a state code and a status field that stores another code, both of which need to be converted. Cheers, Chris Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.