<%@ Page language="vb"%>
<!--#include file="TreeGridFramework.aspx"-->
<script language="vb" runat="server">
   '! Support file only, run AjaxTable.html instead !
   ' Uses new ASP.NET style scripting with event Page_Load
   ' -------------------------------------------------------------------------------------------------------------------------------
 Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
      Dim Grid As TreeGrid : Grid = New TreeGrid( _
           "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source=""" + GetPath() + "\\Database.mdb"";Mode=Share Deny None;Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1", _
           "SELECT * FROM TreeData", "id", "", "Parent", "Def")
      '1 - Connection string
      '2 - SQL Selection command to select all rows from database, used also for saving data back
      '3 - Column name in database table where are stored unique row ids
      '4 - Prefix added in front of id, used if ids are number type
      '5 - Column name in database table where are stored parent row ids, if is empty, the grid does not contain tree
      '6 - Column name in database table where are stored Def parameters (predefined values in Layout, used usually in tree _
      Dim XML As String : XML = Request("TGData")
      Response.ContentType = "text/xml"
      Response.Charset = "utf-8"
      Response.AppendHeader("Cache-Control", "max-age=1, must-revalidate")
      If XML <> "" And XML <> Nothing Then
         Grid.SaveXMLToDB(XML)            ' Saves data to database
         Response.Write("<Grid><IO Result='0'/></Grid>")
      Else
         Response.Write(Grid.LoadXMLFromDB())  ' Loads data from database  
      End If
   End Sub
   ' -------------------------------------------------------------------------------------------------------------------------------
</script>
