ASP.NET Visual Basic examples

Do not run this file locally
Run it from your (local) web server where is installed IIS and ASP.NET (1.0, 1.1, 2.0, 3.0, ...).

The ASP.NET service program must have write access to /Examples/AspNetVB/Database.mdb file
To permit write access on Windows XP right click to file Database.mdb in My Computer, select Properties -> Security -> Users and set Full control to Allow. If you don't have Security item in Properties, run My Computer, in menu select Tools - > Folder options -> View and uncheck Use simple file sharing option.


Example index

Basic AJAX
Basic usage of asynchronous background (new style) communication with server and SQL database communication
DataTable database access The simplest demonstration of using ASP.NET and AJAX with classes DataTable and OleDbDataAdapter link
OleDbCommand database access The simplest demonstration of using ASP.NET and AJAX with classes OleDbCommand and OleDbDataAdapter link
Using TreeGrid ASP.NET framework How to generate data from and update data to SQL database using prepared TreeGridFramework.aspx link
Page in old ASP style How to use old style page creating by direct code instead of use Page_Load event link
Page with code behind How to use excluded code to .vb file by @Page Src attribute link
ASP.NET web service The demonstration of ASP.NET SOAP web service that creates and processes TreeGrid XML data link
Tree in database How to generate tree from and store tree to SQL database table link
TreeGrid API for communication and reloading Using TreeGrid Extended API link
 
Basic <form> Submit
Basic usage of synchronous (old style) communication with server and SQL database communication
DataTable database access The simplest demonstration of using ASP.NET and <form> submit with classes DataTable and OleDbDataAdapter link
OleDbCommand database access The simplest demonstration of using ASP.NET and <form> submit with classes OleDbCommand and OleDbDataAdapter link
Using TreeGrid ASP.NET framework How to generate data from and update data to SQL database using prepared TreeGridFramework.aspx link
Page in old ASP style How to use old style page creating by direct code instead of use Page_Load event link
Page with code behind How to use excluded code to .vb file by @Page Src attribute link
Tree in database How to generate tree from and store tree to SQL database table link
 
Applications
Few more complex applications with TreeGrid upon SQL database and AJAX communication
Grid from database table Demonstrates advanced generating from and updating to database link
Complete application - Schools Complete application to demonstrate generating from and updating to different database tables with various structure link
File and directory browser Demonstration of manipulating files and directories with TreeGrid link
 
Server paging
Examples of writing server side support scripts for server side paging upon SQL database
Sorting, uploading changes and export Demonstrates sorting feature, saves changes back to database, supports also export to Excel, all upon SQL database link
Grouping Demonstrates grouping with server paging and client child paging - all children from groups are sent to server at once link
Grouping with server child paging Demonstrates grouping with server paging and also server child paging link
 
Server paging with TreeGrid server library
Examples of writing server side support scripts for server side paging with helper library shipped with TreeGrid
DataTable database access Demonstrates using TreeGrid server library upon SQL database with classes DataTable and OleDbDataAdapter link
OleDbCommand database access Demonstrates using TreeGrid server library upon SQL database with classes OleDbCommand and OleDbDataAdapter link
Complex application upon XML file Shows using TreeGrid server library upon XML file on disk with all supported features, especially grouping link
Sharing and synchronization upon XML file Shows sharing data among more clients and automatic updating client's data after data on server are modified by another client link


Basic AJAX

Basic usage of asynchronous background (new style) communication with server.
Basic demonstration of generating data from and uploading data to SQL database.
All examples are located at "Examples/AspNetVB/BasicAjax/.." directory.
Data are downloaded from or uploaded to server by JavaScript XmlHttpRequest object on background, without reloading/submitting the page content.
You can check from configuration menu option Auto update changes to server for immediate updates after edit/modify.
When debugging, you can set <treegrid ... Debug='3' ... > to see communication with server. It opens two new browser's windows. You can see XML data or ASP.NET error server returned.
Remember, in Ajax communication, the ASP.NET page must return only xml data, not any standard html tags like <html> or <!doctype>.
See documentation
AJAX versus submit and also tutorial Identifying rows when uploading.

DataTable database access
Main file DataTable.html, support code DataTable.aspx
Layout file in DBDef.xml, data in database table "TableData".
The simplest demonstration of using ASP.NET and AJAX. It generates data from database table 1:1 including id. Also updates changes to database according to id.
It uses .NET classes DataTable and OleDbDataAdapter to access database. It uses class XmlDocument to process and generate XML.

OleDbCommand database access
Main file SqlCommand.html, support code SqlCommand.aspx
Layout file in DBDef.xml, data in database table "TableData".
The simplest demonstration of using ASP.NET and AJAX. It generates data from database table 1:1 including id. Also updates changes to database according to id.
It uses .NET classes OleDbCommand and OleDbDataReader to access database. It uses class XmlDocument to process XML, but generates XML as standard string.

Using TreeGrid ASP.NET framework
Main file Framework.html, support code Framework.aspx, framework code /Framework/TreeGridFramework.aspx
Layout file in DBDef.xml, data in database table "TableData".
The same example as previous two, but with using functions from TreeGrid ASP.NET Framework. It also shows using custom parameters in <treegrid> tag.

Page in old ASP style
Main file FrameworkAspStyle.html, support code AjaxTableFrameworkAspStyle.aspx, framework code /Framework/TreeGridFramework.aspx
Layout file in DBDef.xml, data in database table "TableData".
The same example as previous one, but uses old style page creating by direct code instead of use Page_Load event.

Page with code behind
Main file CodeBehind.html, support code CodeBehind.aspx, code behind CodeBehind.aspx.vb
Layout file in DBDef.xml, data in database table "TableData".
The same example as the first example, but uses code excluded to .vb file by @Page Src attribute.
When using Visual Studio, you can use CodeBehind attribute instead of Src, but you need to compile the .vb file.

ASP.NET web service
Main file DataTable.html, support code Service.asmx
Layout file in DBDef.xml, data in database table "TableData".
The demonstration of ASP.NET SOAP web service that creates and processes TreeGrid XML data.

Tree in database
Main file TreeFramework.html, support code TreeFramework.aspx, framework code /Framework/TreeGridFramework.aspx
Layout file in TreeDef.xml, data in database table "TreeData".
Generates treetable from database table with column Parent where are relations Parents/Children. Parent column contains parent's id of the child. For root rows it contains "#Body", for fixed rows "#Head" or "#Foot".
Uploaded rows are still identified by preset and standardly generated id attributes.
Uses functions from TreeGrid ASP.NET Framework.

TreeGrid API for communication and reloading
Main file API.html, support codes Framework.aspx and TreeFramework.aspx, framework code /Framework/TreeGridFramework.aspx
Layout files in DBDef.xml and TreeDef.xml, data in database tables "TableData" and "TreeData".
It shows two tables from previous examples and demonstrates Extended API functions for reloading, changing data source when reloading, catching data event and so on.


Basic <form> Submit

Basic usage of synchronous (old style) communication with server.
Basic demonstration of generating data from and uploading data to SQL database.
All examples are located at "Examples/AspNetVB/BasicSubmit/.." directory.
Data are included in page in hidden <input>. Changes are sent to server in this hidden <input> of submitted <form> on page.
See documentation
AJAX versus submit and also tutorial Identifying rows when uploading.

DataTable database access
Main file DataTable.aspx
Layout file in DBDef.xml, data in database table "TableData".
The simplest demonstration of using ASP.NET and standard page submit. It generates data from database table 1:1 including id. Also updates changes to database according to id.
It uses .NET classes DataTable and OleDbDataAdapter to access database. It uses class XmlDocument to process and generate XML.

OleDbCommand database access
Main file SqlCommand.aspx
Layout file in DBDef.xml, data in database table "TableData".
The simplest demonstration of using ASP.NET and standard page submit. It generates data from database table 1:1 including id. Also updates changes to database according to id.
It uses .NET classes OleDbCommand and OleDbDataReader to access database. It uses class XmlDocument to process XML, but generates XML as standard string.

Using TreeGrid ASP.NET framework
Main file Framework.html, framework code /Framework/TreeGridFramework.aspx
Layout file in DBDef.xml, data in database table "TableData".
The same example as previous two, but with using functions from TreeGrid ASP.NET Framework. Also shows using custom parameters.

Page in old ASP style
Main file FrameworkAspStyle.aspx, framework code /Framework/TreeGridFramework.aspx
Layout file in DBDef.xml, data in database table "TableData".
The same example as previous one, but uses old style page creating by direct code instead of use Page_Load event.

Page with code behind
Main file ./BasicSubmit/CodeBehind.aspx, code behind CodeBehind.vb
Layout file in DBDef.xml, data in database table "TableData".
The same example as previous one, but uses code excluded to .vb file by @Page Src attribute.
When using Visual Studio, you can use CodeBehind attribute instead of Src, but you need to compile the .vb file.

Tree in database
Main file TreeFramework.aspx, framework code /Framework/TreeGridFramework.aspx
Layout file in TreeDef.xml, data in database table "TreeData".
Generates treetable from database table with column Parent where are relations Parents/Children. Parent column contains parent's id of the child. For root rows it contains "#Body", for fixed rows "#Head" or "#Foot".
Uploaded rows are still identified by preset and standardly generated id attributes.
Uses functions from TreeGrid ASP.NET Framework.


Applications

Few more complex applications with TreeGrid upon SQL database and AJAX communication.

Grid from database table
Main file Grid.html, support codes GridLayout.aspx as layout, GridData.aspx as data, GridUpload.aspx as upload
Data are in database table "TableData".
Demonstrates advanced generating from and updating to database.
Generates treetable from standard database table. Also flips the table and shows data in changed layout.
For every action there is used another support code (Layout, Data, Upload). The layout is also generated.
Rows are identified by one unique editable column, with using full ids (including parents ids).
For demonstration it shows id column, to see what ids are generated by TreeGrid.

Complete application - Schools
Main file Schools.html
Support codes Schools.aspx (main file generates data and also saves changes to database or adds new user),
SchoolsRatings.aspx (loads reviews for given record, used for server child paging),
SchoolsReview.aspx (saves one review to database, called as custom AJAX call).
Layout file in SchoolsDef.xml, data in database tables "Schools_Schools", "Schools_Ratings" and "Schools_Users".
Uses also file SchoolsStars.gif ()
Complete application to demonstrate generating from and updating to different database tables with various structure. Demonstrates also server child paging feature (loading children on demand). And also custom AJAX call.
The application show list of schools that can be sorted and filtered. The records can be added/deleted or modified by logged user or admin. The records can be rated and reviewed by visitors.


File and directory browser
Main file Browser.html, layout file BrowserDef.xml, script returning directory and file tree BrowserData.aspx as data xml.
Suppors JavaScript is in Browser.js, the sample directory tree is located in TestFiles/ subdirectory.
The files can be shown in directories or as direct list, also various sorting and filtering is possible.
The files can be added, moved, deleted, copied and viewed by clicking to left panel of by right click popup menu.
The sample directories and files are located in /TestFiles directory and are independent on the examples distribution so they can be modifed or deleted without problems. The changes are done after click to Save button.


Server paging

Examples of writing server side support scripts for server side paging upon SQL database.
Demonstration of implementation of various TreeGrid features, like sorting, grouping and export.
All examples use AJAX communication (server side paging cannot be done by synchronous communication).
All examples are located at "Examples/AspNetVB/Paging/.." directory.

Sorting, uploading changes and export to Excel
Main file SortingExport.html
Layout is in static file SortingExport_Layout.xml
Script for generating data (page list) SortingExport_Data.aspx
Script for uploading changes back to database SortingExport_Upload.aspx
Script for generating individual page SortingExport_Page.aspx
Script for exporting data to Excel SortingExport_Export.aspx
Data are in database table "TableData".
Demonstrates server side paging upon SQL database. Demonstrates sorting feature, saves changes back to database, supports also export to Excel.
The pages are downloaded on demand from server (when the page is visible by scrollbars).
It is simple example with ineffective database access - it loads all table for every page and throws the rest away.
It also simply reloads all body when rows are added or deleted instead of handling changes in pages.

Grouping
Main file Grouping.html
Layout is in static file Grouping_Layout.xml
Script for generating data (page list) Grouping_Data.aspx
Script for generating individual page Grouping_Page.aspx
Data are in database table "TableData".
Demonstrates server side paging upon SQL database. Demonstrates grouping feature.
Demonstrates server paging but client child paging - all children from groups are sent to server at once.
This is only simple example with not ideal database access (for every page gets all data)
The pages are downloaded on demand from server (when the page is visible by scrollbars).

Grouping with server child paging
Main file GroupingChild.html
Layout is in static file (the same as in previous example) Grouping_Layout.xml
Script for generating data (page list) (the same as in previous example) Grouping_Data.aspx
Script for generating individual page and for individual groups GroupingChild_Page.aspx
Data are in database table "TableData".
Demonstrates server side paging upon SQL database. Demonstrates grouping feature.
Demonstrates server paging with server child paging - group downloads its children only when it is expanded.
This is only simple example with not ideal database access (for every page gets all data)
The pages are downloaded on demand from server (when the page is visible by scrollbars).


Server paging with TreeGrid server library

Examples of writing server side support scripts for server side paging with helper library shipped with TreeGrid.
Demonstration of implementation of various TreeGrid features, like sorting, filtering, grouping and export.
All examples use
TreeGrid server library The library is named TreeGrid.dll and is located at /Server/TreeGrid.dll
Some examples stores data in SQL database, some on disk in XML files.
All examples use AJAX communication (server side paging cannot be done by synchronous communication).
All examples are located at "Examples/AspNetVB/PagingDLL/.." directory.

You can compare these example with the examples in previous section (Server paging) how TreeGrid server library simplifies server side paging implementation.

DataTable database access
Main file DBDataTable.html, support code DBDataTable.aspx
Layout file in DBDef.xml, data in database table "TableData".
Demonstration of using TreeGrid server library for server side paging upon SQL database.
This example shows all TreeGrid features sorting, filtering, grouping, calculations, uploading changes and export to Excel.
It uses .NET classes DataTable and OleDbDataAdapter to access database. It uses class XmlDocument to process and generate XML.

OleDbCommand database access
Main file DBSqlCommand.html, support code DBSqlCommand.aspx
Layout file in DBDef.xml, data in database table "TableData".
Demonstration of using TreeGrid server library for server side paging upon SQL database.
This example shows all TreeGrid features sorting, filtering, grouping, calculations, uploading changes and export to Excel.
It uses .NET classes OleDbCommand and OleDbDataReader to access database. It uses class XmlDocument to process XML, but generates XML as standard string.

Complex application upon XML file
Main file File.html, support code File.aspx
Layout file in FileDef.xml, data in file FileData.xml.
Demonstration of using TreeGrid server library for server side paging upon XML file on disk.
This example shows all TreeGrid features sorting, filtering, grouping, calculations, uploading changes and export to Excel.
It demonstrates especially complex grouping feature and cell editing in various groups.
The complete description is in the example itself.

Sharing and synchronization upon XML file
Main file FileSharing.html, support code FileSharing.aspx
Layout file in FileDef.xml, data in file FileData.xml.
Demonstration of using TreeGrid server library for server side paging upon XML file on disk.
This example shows all TreeGrid features sorting, filtering, grouping, calculations, uploading changes and export to Excel.
Demonstrates sharing data among more clients and automatic updating client's data after data on server are modified by another client.
The complete description is in the example itself.