Installing

DataTables and Editor are powerful libraries, but before you can use them, they need to be installed on your system! This guide walks through how to download the .NET Editor package and set it up. The end result will be the ability to run all of the Editor examples in your .NET environment.

This installation is a simple four step process which the documentation below will guide you though.

Download

To download the Editor .NET package, open the Editor download page and select the Editor .NET package. If you already have a DataTables account the download will start immediately. If you don't have a DataTables account you will be asked to create one to start a trial.

When the download completes, unzip the files and open the Visual Studio file (if you don't have Visual Studio, Microsoft publish a free community edition).

Examples SQL

With the project successfully opened in Visual Studio, we now need to load your database with the tables and data required for the Editor examples. The .NET libraries work with a number of different databases, each of which requires its own SQL. The following links contain the SQL needed for each of the supported databases:

Select the appropriate file for your database and then run the SQL contained within on your database access portal (SQL Server Management Studio, CLI, phpMyAdmin or pgAdmin3 for example).

Database connection

The next step is to set up the database connection so the Editor libraries can interact with the server, reading and modified data as required. This is done through the Database class in the DataTables namespace, which is a database abstraction layer, so it can interface with any of the above database types.

In each controller a Database class instant is initialised. This class uses ADO.NET connection pooling to efficiently connect to your database, while ensuring that each Ajax request is independent of other requests:

var settings = Properties.Settings.Default;

using (var db = new Database(settings.DbType, settings.DbConnection))
{
    ...
}

A using() statement is used to ensure that the database connection is correctly closed after the controller has finished using it.

In the above code, you'll notice that two application properties are used. These are defined in the project's settings and can be reused throughout your application, referenced and managed from a singe location, should you need to change them later. To modify these properties, double click the Settings.settings file in the application Properties option (in the Solution Explorer).

There are two settings defined for the example application:

  • DbType - This defines the database type you are connecting to and can be one of:
    • azure - Microsoft Azure
    • mysql - MySQL
    • postgres - PostgreSQL
    • oracle - Oracle
    • sqlite - SQLite
    • sqlserver - SQL Server
    • sqlserverce - SQL Server CE (for local file databases)
  • DbConnection - This is the database connection string to connect to the SQL server. The exact format of the connection string depends upon the server being used, but typically it included the server host name / address, user name and password. The Connection Strings web-site can be useful if you aren't sure of what connection string to use for your server.

Running the examples

That's all the set up that is needed to run the examples! To actually run them, now press F5 or select the Start debugging option from the Debug menu in Visual Studio.

Next steps

With the examples running, the next step is to start experimenting with the examples and understanding how the Editor C# code operates. Beyond that, you can start to include Editor in your own applications (Web API, MVC)!