Note: Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save his-or-her own copy.
Objectives | Resources |
|
|
ICE 05 INSTRUCTIONS
SETUP EXERCISE ENVIRONMENT
- Look at the Instructions from the previous ICE (ICE 04) to setup the exercise environment
ICE 05 Part 1: Working with the DataSet, DataTable, and DataRow object to Modify Data
- Create a new datacontrol page by copying and pasting from datacontrol2.aspx
- Add a button object to the page, double click it from the design view to access its event handler
- Review the ASP.NET Documentation on adding a new row to a dataset.
- In additional, look through Working with Datasets in Visual Studios, especially the part called Datasets and XML to better understand how DataSets work.
- Use the DataSet object "soup" to create a new DataRow for the DataTable that holds the xml data.
HINT: you must first get the DataTable object from soup and then create a DataRow object based on the DataTable - Modify the new DataRow to represent your favorite artists name, nationality, movement and birthdate (hardcode these at first)
- Add the new DataRow to the DataTable in the DataSet
- Rebind the GridView, to refresh its display on the webpage
ICE 05 Part 2: Allow for User Input and Write to the XML File
- Add TextBox form elements to gather user data that you use to update the artist.xml file.
- Write the DataSet back out to the artist.xml file using the DataSource object. You will need to provide a file path in addition to the file name:
string FilePame = Server.MapPath("~/App_Data/artists.xml")
HINT: you may want to look at the following MrBool article: Adding and Removing Records from DataSet/XML and Populate Grid using ASP.NET and C#
When you get done with the above exercises, show your Instructor.