• Advertisement
Sign in to follow this  

[web] Retrieving data from a dataset

This topic is 4145 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, been working on this one problem all day and now my brains are about to melt and come out of my ears. I have a web form (ASP.Net 1.1, C#) that will (hopefully, eventually) display information brought back from a database. I have a couple of drop down lists and some text boxes and I aim to populate these with the relevant data when the user chooses a certain option from a "master" drop down list. Take, for example, a database with character information. There's one "master" drop down list, populated with all the different character names, then, when the user chooses a character from this list, the text boxes are filled with the relevant database entries for character history etc. I've already populated the drop down lists using a datareader, my problem is trying to work with a dataset, holding all the other information, to do the further actions mentioned in the last paragraph. I've read up on datatables and dataviews but all the examples ever seem to mention is databinding an entire row to a control, never one specific item of data. If anyone can give me any pointers it'd be much appreciated. Cheers [Edited by - Medhatter on October 16, 2006 9:23:15 AM]

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure I completely understand what your issue is. If you're simply trying to populate a label or textbox from a cell in a DataTable, it would be:


myLabel.Text = myDataTable.Rows[<whatever_your_row_number_is>]["ColumnName"] as String;

Share this post


Link to post
Share on other sites
Agh! I have done this exact thing! Now if only I could remember how to do it! We had an assignment where we had to load in a dataset from an XML file and populate a series of 4 dropdown list boxes. When the user made a selection in one of the drop down list boxes, the ones below them had to be updated based on what was selected. You are looking to do something similar, right?

I think what I ended up doing was loading the dataset from the XML file when the form loaded. I then populated the first drop down list box with the first option. Everything else then loaded according to what was in that.

If you are really interested, I could zip up the code for you and e-mail it.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement