Thursday 28 February 2013

Created .aspx pages and Connected to the Database

Sudeep gave us a task to create two .aspx pages, and to link the first page with the second page and then asked to connect this pages with the Database. So that if once connected to the database we can Add, Update, Delete the data in the table that is stored in the database.
I have created one table GetJob in my database 'DB1' with the following columns and inserted some values to it:
  • JobCode
  • Vacancy
  • Post
  • Company
  • City
After creating a table I have added two web forms by selecting Asp.Net Empty Web Application in Visual Studio. The forms are named as Entry.aspx and JobDetails.aspx.
In Entry.aspx I have taken a Gridview Control(GridView is use to accept, display and edit data on a web page) and one Button(ADD).
Then I have provided a link to the ADD button that will transfer directly to second page i.e JobDetails.aspx wherein I have created one table with the same number of columns as in the GetJob table and then  within the table i have taken 5  labels and 5 text boxes. Along with that one button(SAVE) to save the data to the database. When we click to SAVE button it saves the data in the database. This I Have done through connectivity with SQL Server.
 Sudeep also told us to make the entire process more clear and asked us to do the following:
  •  Some validations the the text boxes.
  • Assign a Primary key to the first column of a table i.e'JobCode' and also it should generate automatic values once we switch to the form wherein Details need t o add.
  • With the Add link there should be two more links Update and Delete.
  • Instead of taking textbox towards the label 'City' there should be a DropDown List to give a chance to select one from many cities. 
  • After saving a JobDetails that page should redirect to the Entry.aspx page to add another Vacancies if required.

1 comment:

  1. Leena, you have done very well on this task. I was very surprised to see this completed in one day. Continue to challenge yourself to do more complex tasks.

    ReplyDelete