The template set that comes with smartDBforms.NET is named smartDBtemplates. It consists of several files. The file that holds the templates is TemplatesStorage.ascx. It covers almost all database column types.
All templates take care of the data validation. They have built-in validators which prevent the user from entering inaccurate data. The templates also observe if the data column allows Null values or not. If the data column is non-nullable then a required-value validator is used.
Here is a list of the templates:
AutoIncrementTemplate - Displays columns which are auto incremented. Auto incremented columns are numeric and they are never editable. They serve as primary key for the tables.
StringTemplate- Displays columns which are of type String with size no more than 255 characters.
BooleanTemplate- Displays boolean columns( "bit" in Sql Server ). Shows check box in edit mode and Yes/No in read-only mode.
NumberTemplate - Handles the columns of integral
types( int, byte, etc. ). Uses range validator to validate the data. The
template restricts the allowed values according to the datatype of underlying
database column.
You can use the MaximumValue and MinimumValue adhoc
properties in the SmartDBControl.AdHocProperties collection to additionally
restrict the allowed values.
FloatTemplate - Handles the columns of floating-point
types (Single, Double, Decimal). Uses range validator to validate the data.
The MaximumValue and MinimumValue are adjusted according to the column type. If
the column type is Decimal the Max and Min range is further adjusted according to
the underlying Sql Server type - money, smallmoney, and according to the numeric
range and scale.
You can use the MaximumValue and MinimumValue adhoc
properties in the SmartDBControl.AdHocProperties collection to additionally
restrict the allowed values.
FKDropDownTemplate - Handles data columns which participate in foreign key. Can handle also cases when the foreign key is multi foreign key( has more than one column ).
Instead of the value of the column the template displays a descriptive text taken from the parent data row. For example if the foreign key is the id column of the Employee table, the template displays the employee's name instead of the employee's id.
MoneyTemplate - Handles columns with SQL type
"money" and "smallmoney". The value is displayed together with the currency
symbol for the current locale.
Adhoc property with name CurrencySymbol can be added to the
SmartDBControl.AdHocProperties collection in order to override the currency symbol.
Set the value of the adhoc property to the new currency symbol. In
order to remove the currency symbol set the value of the adhoc property to empty
text.
You can use the MaximumValue and MinimumValue adhoc
properties in the SmartDBControl.AdHocProperties collection to additionally
restrict the allowed values.
DateTemplate - Handles columns of type DateTime. Uses a javascript popup calendar. Alos allows the user to enter the date manually. Allows the user to edit only the date part.
DateTemplateMS - Handles columns of type DateTime. Uses the the standard ASP.NET Calendar control. Allows the user to edit only the date part.
DateTimeTemplate - Handles columns of type DateTime. In edit mode renders textbox. Allows the user to edit both the date and time parts.
LargeTextTemplate - Handles text columns, where the column size is more than 255 characters. Uses TEXTAREA to edit the value.
ImageFromDBTemplate - Handles blob columns which contain images. Displays the image and allows the user to upload a new one.
FileFromDBTemplate - Similar to ImageFromDBTemplate. Handles blob columns which contain files. Allows the user to download the current file or upload a new one.
FileNameFromDiskTemplate - Handles columns which are of type string, where the value is a name of a file. The file is stored separately on the file system. The template is not included in the template selection method. You can use explicit template selection by setting the TemplateID of SmartDBControl.
The folder where the files reside is specified in the appSettings section in Web.config. The setting is named SDBF_UploadDirectory and must point to a virtual directory. For example "~/UploadDir/".
In ReadOnly mode the FileNameFromDiskTemplate template displays either a link to download the file or an image depending on the extension of the actual file. In Edit mode the user can upload a new file. The file is saved in the designated folder and only the file name is stored in the database. If the database column has text length limitation then the file name is shortened( preserving the extension ) in order to fit into the specified limit.
URLTemplate - Handles columns of type string, where the value is an URL. In read-only mode displays the url as a hyperlink. In edit mode renders a text box.
EmailTemplate - Handles columns of type string, where the value is an email address( Example: name@company.com). In read-only mode displays the email as a mailto hyperlink. In edit mode renders a text box and validates the entered email address.
GuidTemplate - Handles columns of type Guid(uniqueidentifier in SQL Server, Replication ID in MS Access). In edit mode allows the user to generate or enter a new guid value.