<%@ Page language="c#"%>
<!-----------------------------------------------------------------------------------------------------------------
Example of TreeGrid using synchronous (submit, non AJAX) communication with server
Example of simple table without tree
Uses DataTable for database communication
Uses old ASP style scripting
Uses MS Access database TableData.mdb as data and XML file TableDef.xml as TreeGrid layout
! Check if ASP application has write access to TableData.mdb file
------------------------------------------------------------------------------------------------------------------>

<!--#include file="TreeGridFramework.aspx"-->

<html>
   <head>
      <link id="GridCSS" href="../../Grid/Grid.css" title="GridStyle" type="text/css" rel="stylesheet">
      <script src="../../Grid/GridE.js"> </script>
   </head>
   <body>
      <div style="WIDTH:100%;HEIGHT:90%">
         <bdo 
            Layout_Url="TableDef.xml" 
            Data_Tag="TGData" 
            Upload_Tag="TGData" Upload_Format="Internal"
            Export_Url="Export.aspx" Export_Data="TGData" Export_Param_File="SubmitTable.xls"
            ></bdo>
      </div>
      <form method="post" runat="server">
<%
// -------------------------------------------------------------------------------------------------------------------------------
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 TableData",    // 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
      "",                           //Column name in database table where are stored parent row ids, if is empty, the grid does not contain tree
      "");                          //Column name in database table where are stored Def parameters (predefined values in Layout, used usually in tree
string XML = Request["TGData"];
if (XML != "" && XML != null) Grid.SaveXMLToDB(XML);             // Saves data to database
XML = Grid.LoadXMLFromDB().Replace("'", "&apos;").Replace("&", "&amp;");  // Loads data from database  
// -------------------------------------------------------------------------------------------------------------------------------
%>
         <input id="TGData" name="TGData" type="hidden" value='<%=XML%>'/>
         <input type="submit" value="Submit changes to server"/>
      </form>
   </body>
</html>
