Step 1 : Create Table and Stored Procedure
Step 2 : Create Web Application
- "Start" -> "All Programs" -> "Microsoft Visual Studio 2010".
- "File" -> "New Project" -> "C#" -> "Empty Project" (to avoid adding a master page).
- Provide the website a name such as "DisplayingFormDataUsingWebAPI" or another as you wish and specify the location.
- Then right-click on the Solution Explorer -> "Add New Item" -> Add Web Form.
- Drag and drop three text boxes and one Button onto the <form> section of the Default.aspx page.
Step 3 : Create Property Class
Step 4: Add Web API Controller Class
Step 5: Create Repository Class to add and view records
Step 6: Create Post and Get method
Step 7: Call ASP.Net Web API Controller method
Now add another record.
Now you have seen how the insertion of records into the database and display it using Web API with Web Forms works.
- Do a proper validation such as date input values when implementing.
- Make the changes in the web.config file depending on your server details for the connection string.