SUMMARY
The AJAX Control Toolkit provides a lot of useful controls which could be used in the smartDBforms.NET templates. This tutorial shows how to configure your development environment and extend smartDBforms.NET functionality with AJAX Control Toolkit. An example with MaskedEditExtender is demonstrated for entering phone numbers in specific format.
MORE INFORMATION
Before extending the smartDBforms.NET templates you should make sure that you fulfil all the prerequisites for using AJAX Control Toolkit .
1. Preparing ASP.NET AJAX
ASP.NET AJAX Control Toolkit depends on the ASP.NET AJAX technology. If you are using .NET 3.5 SP1 then ASP.NET AJAX is already installed and you don't have to do anything.. If you have only .NET 2.0 installed then you have to download and install ASP.NET AJAX 1.0
For ASP.NET 3.5 web sites Visual Studio puts automatically all required references in your web.config. For ASP.NET 2.0 you can see how to configure ASP.NET AJAX 1.0 in the following documentation - Configuring ASP.NET AJAX 1.0
2. Preparing AJAX Control Toolkit
The next step is to install AJAX Control Toolkit. The latest release can be downloaded from AJAX Control Toolkit Downloads. There are two versions - one for .NET 3.5 and one for .NET 2.0. The latest release of AJAX Control Toolkit that has version for .NET 2.0 is Release 20229.
Open the Get Started with the AJAX Control Toolkit tutorial to learn how to configure Visual Studio toolbox.
3. Extending smartDBforms.NET template set.
The next step is to add a new smartDBforms.NET template which will use Masked input to enter phone numbers.
Open the smartDBforms.NET template set file which is located at <WebSite>/smartDBtemplates/TemplatesStorage.ascx. Copy and paste the TemplateHolder with ID StringTemplate and set the new ID to PhoneTemplate.
Next step is to drag and drop the MaskedEditExtender from the toolbox over the TextBoxValueString textbox in PhoneTemplate Edit template. After that set the Mask property to (999)999-9999 and ClearMaskOnLostFocus to False.
Now the new PhoneTemplate is ready to be used in the new data entry forms.
4. Using the new AJAX Control Toolkit template in the database forms.
In order to use the new PhoneTemplate in your form open the form, find the desired field and change its property TemplateID to PhoneTemplate.
In order the MaskedEditExtender to work it requires the ASP.NET page to contain a ToolkitScriptManager control. Just drag and drop the ToolkitScripManager from the toolbox to the top of the ASP.NET page.
CONCLUSION
After the changes the Phone database field allows the users to enter only digits and imposes a predetermined format.