--------------------------------------------------------------
- from solution xplorer.
- right click on the App_data and select add new item.
- add a new Sql server Database.
- add the tables category and item. ( erm both will have their own id like catid and itemid)
- add in the necessary attributes and done =)
step 2: Create a master page
- from solution xplorer.
- right click on the globe thing and select add new item.
- select masterpage.
- make sure the Select master page checkbox is not ticket.
- make sure the place code in separate file is checked.
- cut the content place holder. (dont delete it)
- place a HTML table.
- merge the rows and paste the content place holder to the last row.
step 3: Design in the way the sample webside request.
step 4: Create add catergory aspx
- from solution xplorer
- right click on the globe thing and select add new item.
- select webform and name it accordingly.
- make sure the Select master page checkbox is ticked. and select the masterpage u created.
- make sure the place code in separate file is checked.
- drag in a HTML table and other necessary control variables.
* control variables are items in the toolbox.
- add in the validation control and summary to the respective locations.dun forget save button and label.
- drag a sqldatasource and config datasource. config it to add cat table.
- select the *
- go to advance and tick the both box. Done and finish.
- insert query. select the parameters and set parameter source to control
- select the textbox/ dropdown list to the respective parameters.
- double click the save button and the enter the code under button_click sub.
( in this test u all are not required to do duplication check)
Try
SqlDataSource1.Insert()
Label2.Text = TextBox2.Text + " is saved!"
Catch ex As Exception
Label2.Text = ex.Message.ToString
End Try
- compile and run the webpage to test the save button
-upon successful save, the add cat table has the data tat u just key in.
* u can do so by right clicking on the database.mdf and right clicking on the addcat table and
show table data. ( successful save will sercure 15 marks of the test).
step 5 : Create add item aspx.
- similar to how u add cat.
- make sure the place code in separate file is checked.
- drag in a HTML table and other necessary control variables.
* control variables are items in the toolbox. ( dun forget the drop down list)
- add in the validation control and summary to the respective locations. dun forget save button and label.
- drag a sqldatasource and config datasource. config it to add item table.
- select the *
- go to advance and tick the both box. Done and finish.
- insert query. select the parameters and set parameter source to control
- select the textbox/ dropdown list to the respective parameters.
- double click the save button and the enter the code under button_click sub.
( in this test u all are not required to do duplication check)
Try
SqlDataSource1.Insert()
Label2.Text = TextBox2.Text + " is saved!"
Catch ex As Exception
Label2.Text = ex.Message.ToString
End Try
- compile and run the webpage to test the save button. (another 15% of the test)
*check the item table again if the items are successfully saved. =)
Step 6: view cat
- Create view cat aspx. ( lol create so many pages liao should know how to create another page ya?)
* dun forget to check the select master page.
- drag the category table from the server explorer into the view cat page.
- make sure the table is binded to the sqldatasource.
- click on the smart tag of the cat table.
- enable edit, update and sorting.
step 7 view item
- totally similar to the view cat. =)
step 8
- go to masterpage.
- go the the menu smart tag.
- edit the NavigationUrl to link it to the respective pages.
- test run and check tat all's working =)
point to take note.
- if the data is not saved. check ur insert query again. make sure all parameters and set to control
and set to the respective validation controls.
--------------------------------------------------------------
JIAYOU EVERYONE! ^^
No comments:
Post a Comment