Building Forms without Forms Services – Introduction

For some organizations, it is not possible to use Forms Services either as an architectural or budget constraint. Therefore, other avenues of development must be considered when looking to move to a paperless form process with zero footprint form fill-in capabilities. When not using InfoPath and Microsoft Office Forms server, a traditional solution is to build forms using standard WebPart development techniques, submitting the data to either a corporate database or to a SharePoint list for storage.

The ordinary approach to custom forms development in SharePoint is to construct a custom WebPart for data submission by instantiating all the required .NET controls needed on the page, binding the controls with some sort of validation logic, and then submitting the entered data to a backend data store such as SQL Server by using an event handler to call a SQL stored procedure. This development process necessitates diligence from development to production code release because binding the controls to the WebPart doesn’t allow the use of an interactive, intuitive Surface Designer that Microsoft InfoPath would normally provide. As an example, I will demonstrate building a simple SharePoint WebPart that could be used to submit an ID code to a small backend SQL table and could eventually be used as a boilerplate for more complex data by appending some additional logic.

In order to build the form WebPart using solely inherent WebPart functionality, there are several steps that must be taken. Some of these steps will setup the necessary class files for assimilation into the WebPart framework; however a great majority of the code you will write will provide the necessary logic in order to gather user information, and push the harvested data into a backend storage system. The most typical of these is a SQL database; therefore we will closely examine how to use ADO.NET 2.0 to call a T-SQL stored procedure to manage the data submission.

  1. Set up the WebPart class
  2. Declare Variables, Assign Controls, And Set up Exception Management
  3. Setup the Connection to the SQL Server with ADO.NET 2.0
  4. Setup the Validation Controls
  5. Wiring the Submission Event

Each of these tasks is explained exhaustively in the following detailed sections. The end result is a Forms WebPart that targets a common InfoPath task, putting a Text Box control onto a WebPart page, which can then be used in order to submit data to a backend SQL database.