<%@ Page language="c#"%>
<!--#include file="TreeGridFramework.aspx"-->
<script language="c#" runat="server">
//! Support file only, run AjaxTable.html instead !
// Uses new ASP.NET style scripting with event Page_Load
// -------------------------------------------------------------------------------------------------------------------------------
void Page_Load(object sender, System.EventArgs e) 
{
   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",     // SQL Selection command to select all rows from database, used also for saving data back
      "id",                         //Column name in database table where are stored unique row ids  
      "",                           //Prefix added in front of id, used if ids are number type
      "Parent",                     //Column name in database table where are stored parent row ids, if is empty, the grid does not contain tree
      "Def");                       //Column name in database table where are stored Def parameters (predefined values in Layout, used usually in tree
   string XML = Request["TGData"];
   Response.ContentType = "text/xml";
   Response.Charset = "utf-8";
   Response.AppendHeader("Cache-Control","max-age=1, must-revalidate");
   if (XML != "" && XML != null) {
      Grid.SaveXMLToDB(XML);             // Saves data to database
      Response.Write("<Grid><IO Result='0'/></Grid>");
      }
   else Response.Write(Grid.LoadXMLFromDB());  // Loads data from database  
}
// -------------------------------------------------------------------------------------------------------------------------------
</script>
